dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.38k stars 1.42k forks source link

ALEHover text not appearing in floating preview #4757

Open jsit opened 2 months ago

jsit commented 2 months ago

Information

VIM version

NVIM v0.9.0

Operating System: macOS

What went wrong

g:ale_hover_to_floating_preview doesn't seem to be working for :ALEHover

From the help docs:

When using Neovim or Vim with popupwin, if g:ale_hover_to_floating_preview or g:ale_floating_preview is set to 1, the hover information will show in a floating window.

Reproducing the bug

My minimal vimrc:

set runtimepath+=$HOME/.vim/bundle/ale
let g:ale_hover_cursor = 1
let g:ale_hover_to_floating_preview = 1
  1. Use the vimrc above
  2. Open a TypeScript file
  3. Move cursor over a variable
  4. Notice the :ALEHover info shows in the echo line, not in the floating preview

I tried doing :ALEDisable | ALEEnable to reload the settings, but this doesn't help.

I'm also not sure why these settings aren't showing up in :ALEInfo?

:ALEInfo

Expand
 Current Filetype: typescriptreact
Available Linters: ['cspell', 'deno', 'eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
  Enabled Linters: ['eslint', 'tsserver']
  Ignored Linters: []
 Suggested Fixers:
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 Linter Variables:
 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 = '[%linter%/%severity%] %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 = {'typescript': ['eslint', 'prettier'], 'typescriptreact': ['eslint', 'prettier'], 'json': ['prettier'], 'javascript': ['eslint', 'prettier'], 'css': ['stylelint'], 'javascriptreact': ['eslint']}
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 = {'mustache': ['ember-template-lint'], 'typescript': ['eslint', 'tsserver'], 'scss': ['stylelint'], 'typescriptreact': ['eslint', 'tsserver'], 'javascriptreact': ['eslint'], 'json': ['eslint'], 'html': ['pa11y'], 'handlebars': ['ember-template-lint'], 'javascript': ['eslint'], 'css': ['stylelint'], 'markdown': ['proselint']}
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 = '[%linter%/%severity%] %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 = {'ControlP': {'ale_enabled': 0}}
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_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:
(executable check - success) yarn
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/xxx/Code'' && ''yarn'' eslint -f json --stdin --stdin-filename ''/Users/xxx/Code/test.tsx'' < ''/Users/xxx/tmp/nvim.xxx/NFKavt/1/test.tsx''']
<<>>
[{"filePath":"/Users/xxx/Code/test.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]}]
<<>>
(executable check - success) .yarn/sdks/typescript/bin/tsserver
(started) ['/bin/bash', '-c', '''.yarn/sdks/typescript/bin/tsserver''']
jsit commented 2 months ago

It looks like the truncated_echo conditional on line 47 of autoload/ale/hover.vim is evaluating to true, preventing it from getting to the floating preview check:

https://github.com/dense-analysis/ale/blob/506d392f6a72a2a494f9575c087e2f518811a534/autoload/ale/hover.vim#L47-L54

If I comment out lines 47-50, it works as expected.

I don't know how to make this not true?