dense-analysis / dense-analysis/ale
Ale's ALEError and ALEWarning highlights override the Search highlight
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
## Information
**VIM version**
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 6 2021 06:43:05)
macOS version - x86_64
Operating System: macOS Big Sur 11.2.3
## What went wrong
I've set the Spellbad highlight to show a red undercurl (ctermfg and ctermbg are set to none). The ALEError highlight correctly shows any areas with linting errors with a red undercurl. However, this overrides the Search highlight fg and bg, so any searches in areas with linting errors are now not highlighted.
Outside of Ale linting errors the Search highlight still shows correctly.
## Reproducing the bug
1. In my vim colorscheme I have the following highlights set:
```
" This should be enabled as well
set hlsearch
" Spell
hi SpellBad cterm=undercurl ctermul=red ctermfg=none ctermbg=none
hi SpellCap cterm=undercurl ctermul=yellow ctermfg=none ctermbg=none
hi SpellLocal cterm=undercurl ctermul=cyan ctermfg=none ctermbg=none
hi SpellRare cterm=undercurl ctermul=darkmagenta ctermfg=none ctermbg=none
" Search
hi Search ctermfg=black ctermbg=yellow cterm=none
hi IncSearch ctermfg=black ctermbg=yellow cterm=none
```
2. Write some code that will fail your linter, so that Ale will display the ALEError highlight (which is linked to SpellBad by default). You should see a red undercurl (or underline if your terminal doesn't support undercurl).
3. Search for a term that also occurs in the text Ale has marked.
4. Ale will highlight the error, but the search highlight will not show for text where ALEError is showing. Outside of that the search highlight will show correctly.

> Searchterm was `div`, see how it's highlighted correctly outside of the linting error
Relevant dotfiles can be found [here](https://github.com/ismay/dotfiles/tree/d28fcd6f6ecc3c013fb1bc93f41449d5cc228c21)
### :ALEInfo
```
Current Filetype: javascript
Available Linters: ['eslint', 'fecs', 'flow', 'flow-language-server', 'jscs', 'jshint', 'standard', 'tsserver', 'xo']
Enabled Linters: ['eslint', 'fecs', 'flow', 'flow-language-server', 'jscs', 'jshint', 'standard', 'tsserver', 'xo']
Ignored Linters: []
Suggested Fixers:
'eslint' - Apply eslint --fix to a file.
'fecs' - Apply fecs format to a file.
'importjs' - automatic imports for javascript
'prettier' - Apply prettier to a file.
'prettier_eslint', 'prettier-eslint' - Apply prettier-eslint to a file.
'prettier_standard', 'prettier-standard' - Apply prettier-standard to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'standard' - Fix JavaScript files using standard --fix
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'xo' - Fix JavaScript/TypeScript files using xo --fix.
Linter Variables:
let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_suppress_eslintignore = 0
let g:ale_javascript_eslint_suppress_missing_config = 0
let g:ale_javascript_eslint_use_global = 0
let g:ale_javascript_fecs_executable = 'fecs'
let g:ale_javascript_fecs_use_global = 0
let g:ale_javascript_flow_executable = 'flow'
let g:ale_javascript_flow_ls_executable = 'flow'
let g:ale_javascript_flow_ls_use_global = 0
let g:ale_javascript_flow_use_global = 0
let g:ale_javascript_flow_use_home_config = 0
let g:ale_javascript_flow_use_respect_pragma = 1
let g:ale_javascript_jscs_executable = 'jscs'
let g:ale_javascript_jscs_use_global = 0
let g:ale_javascript_jshint_executable = 'jshint'
let g:ale_javascript_jshint_use_global = 0
let g:ale_javascript_standard_executable = 'standard'
let g:ale_javascript_standard_options = ''
let g:ale_javascript_standard_use_global = 0
let g:ale_javascript_tsserver_config_path = ''
let g:ale_javascript_tsserver_executable = 'tsserver'
let g:ale_javascript_tsserver_use_global = 0
let g:ale_javascript_xo_executable = 'xo'
let g:ale_javascript_xo_options = ''
let g:ale_javascript_xo_use_global = 0
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'yml': ['prettier'], 'go': ['gofmt'], 'typescript': ['eslint', 'prettier'], 'typescriptreact': ['eslint', 'prettier'], 'javascriptreact': ['eslint', 'prettier'], 'json': ['prettier'], 'sh': ['shfmt'], 'javascript': ['eslint', 'prettier'], 'fish': ['fish_indent'], 'css': ['stylelint', 'prettier'], 'markdown': ['prettier']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - failure) fecs
(executable check - failure) jscs
(executable check - failure) jshint
(executable check - failure) standard
(executable check - failure) tsserver
(executable check - failure) xo
(started) ['/bin/sh', '-c', 'cd ''/Users/ismay/Projects/github/ismay/superwolff.nl'' && ''/Users/ismay/Projects/github/ismay/superwolff.nl/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/ismay/Projects/github/ismay/superwolff.nl/components/zoom-image/zoom-image.js'' < ''/var/folders/61/0bv_jh4j7jv0znfdbw6p5c180000gn/T/v0iyViO/7/zoom-image.js''']
(executable check - failure) fecs
(executable check - failure) jscs
(executable check - failure) jshint
(executable check - failure) standard
(executable check - failure) tsserver
(executable check - failure) xo
(finished - exit code 1) ['/bin/sh', '-c', 'cd ''/Users/ismay/Projects/github/ismay/superwolff.nl'' && ''/Users/ismay/Projects/github/ismay/superwolff.nl/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/ismay/Projects/github/ismay/superwolff.nl/components/zoom-image/zoom-image.js'' < ''/var/folders/61/0bv_jh4j7jv0znfdbw6p5c180000gn/T/v0iyViO/8/zoom-image.js''']
<<>>
[{"filePath":"/Users/ismay/Projects/github/ismay/superwolff.nl/components/zoom-image/zoom-image.js","messages":[{"ruleId":"no-unused-vars","severity":2,"message":"'BoxShadow' is defined but never used.","line":4,"column":8,"nodeType":"Identifier","messageId":"unusedVar","endLine":4,"endColumn":17},{"ruleId":"no-unused-vars","severity":2,"message":"'ResponsiveImage' is defined but never used.","line":5,"column":8,"nodeType":"Identifier","messageId":"unusedVar","endLine":5,"endColumn":23},{"ruleId":"no-unused-vars","severity":2,"message":"'Background' is defined but never used.","line":6,"column":8,"nodeType":"Identifier","messageId":"unusedVar","endLine":6,"endColumn":18},{"ruleId":"no-unused-vars","severity":2,"message":"'Foreground' is defined but never used.","line":7,"column":8,"nodeType":"Identifier","messageId":"unusedVar","endLine":7,"endColumn":18},{"ruleId":"no-unused-vars","severity":2,"message":"'container' is defined but never used.","line":9,"column":10,"nodeType":"Identifier","messageId":"unusedVar","endLine":9,"endColumn":19},{"ruleId":"no-unused-vars","severity":2,"message":"'alt' is defined but never used.","line":11,"column":37,"nodeType":"Identifier","messageId":"unusedVar","endLine":11,"endColumn":40},{"ruleId":"no-unused-vars","severity":2,"message":"'height' is defined but never used.","line":11,"column":42,"nodeType":"Identifier","messageId":"unusedVar","endLine":11,"endColumn":48},{"ruleId":"no-unused-vars","severity":2,"message":"'margin' is defined but never used.","line":11,"column":50,"nodeType":"Identifier","messageId":"unusedVar","endLine":11,"endColumn":56},{"ruleId":"no-unused-vars","severity":2,"message":"'src' is defined but never used.","line":11,"column":58,"nodeType":"Identifier","messageId":"unusedVar","endLine":11,"endColumn":61},{"ruleId":"no-unused-vars","severity":2,"message":"'width' is defined but never used.","line":11,"column":63,"nodeType":"Identifier","messageId":"unusedVar","endLine":11,"endColumn":68},{"ruleId":"no-unused-vars","severity":2,"message":"'zoomedSize' is assigned a value but never used.","line":15,"column":10,"nodeType":"Identifier","messageId":"unusedVar","endLine":15,"endColumn":20},{"ruleId":"no-unused-vars","severity":2,"message":"'getBaseRect' is assigned a value but never used.","line":18,"column":9,"nodeType":"Identifier","messageId":"unusedVar","endLine":18,"endColumn":20},{"ruleId":"no-unused-vars","severity":2,"message":"'handleAnimationComplete' is assigned a value but never used.","line":35,"column":9,"nodeType":"Identifier","messageId":"unusedVar","endLine":35,"endColumn":32},{"ruleId":"no-unused-vars","severity":2,"message":"'handleKeyDown' is assigned a value but never used.","line":44,"column":9,"nodeType":"Identifier","messageId":"unusedVar","endLine":44,"endColumn":22},{"ruleId":"no-unused-vars","severity":2,"message":"'animate' is assigned a value but never used.","line":75,"column":9,"nodeType":"Identifier","messageId":"unusedVar","endLine":75,"endColumn":16},{"ruleId":"jsx-a11y/click-events-have-key-events","severity":2,"message":"Visible, non-interactive elements with click handlers must have at least one keyboard listener.","line":78,"column":5,"nodeType":"JSXOpeningElement","endLine":80,"endColumn":6},{"ruleId":"jsx-a11y/no-static-element-interactions","severity":2,"message":"Static HTML elements with event handlers require a role.","line":78,"column":5,"nodeType":"JSXOpeningElement","endLine":80,"endColumn":6},{"ruleId":"no-undef","severity":2,"message":"'children' is not defined.","line":81,"column":8,"nodeType":"Identifier","messageId":"undef","endLine":81,"endColumn":16}],"errorCount":18,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":"import { useDebounceCallback } from \"@react-hook/debounce\";\nimport T from \"prop-types\";\nimport { useRef, useState } from \"react\";\nimport BoxShadow from \"../box-shadow\";\nimport ResponsiveImage from \"../responsive-image\";\nimport Background from \"./background\";\nimport Foreground from \"./foreground\";\nimport useWindowListener from \"./window-listener\";\nimport { container } from \"./zoom-image.module.css\";\n\nexport default function ZoomImage({ alt, height, margin, src, width }) {\n const baseRef = useRef(null);\n const foregroundRef = useRef(null);\n const [zoomed, setZoomed] = useState(false);\n const [zoomedSize, setZoomedSize] = useState(0);\n\n // Allow retrieving the base size from within a child component\n const getBaseRect = () => {\n if (!baseRef.current) {\n return undefined;\n }\n\n return baseRef.current.getBoundingClientRect();\n };\n\n /**\n * Handlers\n */\n\n const toggleZoom = () => setZoomed(!zoomed);\n const unzoom = () => setZoomed(false);\n const handleClick = toggleZoom;\n\n // Update zoomed size when the foreground animation is done\n const handleAnimationComplete = () => {\n if (!foregroundRef.current) {\n return;\n }\n\n const rect = foregroundRef.current.getBoundingClientRect();\n setZoomedSize(Math.round(rect.width));\n };\n\n const handleKeyDown = (e) => {\n switch (e.key) {\n case \"Escape\":\n if (zoomed) {\n e.preventDefault();\n unzoom();\n }\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n toggleZoom();\n break;\n default:\n break;\n }\n };\n\n /**\n * Listeners\n */\n\n const debouncedUnzoom = useDebounceCallback(unzoom, 300, true);\n const enabled = zoomed;\n\n // Unzoom whenever something happens that could invalidate the calculations\n useWindowListener(\"scroll\", debouncedUnzoom, { enabled });\n useWindowListener(\"resize\", debouncedUnzoom, { enabled });\n useWindowListener(\"orientationchange\", debouncedUnzoom, { enabled });\n\n // The two animation types\n const animate = zoomed ? \"zoomed\" : \"normal\";\n\n return (\n \n {children}\n \n );\n}\n\nZoomImage.defaultProps = {\n margin: 0,\n};\n\nZoomImage.propTypes = {\n alt: T.string.isRequired,\n height: T.number.isRequired,\n margin: T.number,\n src: T.string.isRequired,\n width: T.number.isRequired,\n};\n","usedDeprecatedRules":[{"ruleId":"lines-around-directive","replacedBy":["padding-line-between-statements"]},{"ruleId":"global-require","replacedBy":[]},{"ruleId":"no-buffer-constructor","replacedBy":[]},{"ruleId":"no-new-require","replacedBy":[]},{"ruleId":"no-path-concat","replacedBy":[]}]}]
<<>>
(executable check - failure) fecs
(executable check - failure) jscs
(executable check - failure) jshint
(executable check - failure) standard
(executable check - failure) tsserver
(executable check - failure) xo
```
Contributor guide
Assessment
This issue has not been assessed yet.