You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: g:ale_hover_cursor is only checked when ALE is initializing. Setting this variable afterwards does not change ALE's behavior. Setting g:ale_hover_cursor in Lazy's config callback per ALE's README example does not work.
I recently started trying noice.nvim and noticed that a window pops up when I move my cursor around:
After looking around and disabling different plugins like coc.nvim and others, I narrowed the issue down to ALE. After searching the internet and asking GPT, I tried adding these into my Nvim config, but they didn't help:
vim.g.ale_echo_cursor = 0
vim.g.ale_hover_cursor = 0
vim.g.ale_cursor_detail = 0
So I turned on debug logging and started tracing the code to see where it came from. Here's the traced callstack:
let [l:info, l:loc] =ale#util#FindItemAtCursor(l:buffer)
ifempty(l:loc)
callale#hover#Show(
\ l:buffer,
\ l:pos[1],
\ l:pos[2],
\ {'truncated_echo': 1},
\)
endif
endif
endfunction
In other words, changing this variable after the callback is registered won't alter ALE's behavior. I am reporting this as a "bug" because this is not my expected behavior. In ALE's documentations, we can set variables in Lazy's config section:
However, setting vim.g.ale_hover_cursor in the config callback function doesn't really work:
It has to be set before require('lazy').setup() is executed, so I think this is a bit counterintuitive. Perhaps it'll be better to add another check for the variable in ale#hover#ShowTruncatedMessageAtCursor or somewhere that makes it possible to change ale_hover_cursor on the fly without doing ALEToggle twice?
In the event this won't be fixed, for anyone that's having the same issue, just do vim.g.ale_hover_cursor = 0 before require('lazy').setup() and it should be fine.
Reproducing the bug
Install folke/noice.nvim
Install ALE
Open a file with LSP support and move the cursor onto a symbol. Notice how an echom command pops up.
:ALEInfo
Expand
The text was updated successfully, but these errors were encountered:
@iton0 Thanks for the tip. I didn't know that's a thing. In which case, if you don't want to implement toggling this option on-the-fly you can close this issue.
Information
VIM version
NVIM v0.10.1
Build type: Release
Operating System: Arch Linux 6.10.10-arch1-1
What went wrong
TL;DR:
g:ale_hover_cursor
is only checked when ALE is initializing. Setting this variable afterwards does not change ALE's behavior. Settingg:ale_hover_cursor
in Lazy'sconfig
callback per ALE's README example does not work.I recently started trying noice.nvim and noticed that a window pops up when I move my cursor around:
After looking around and disabling different plugins like coc.nvim and others, I narrowed the issue down to ALE. After searching the internet and asking GPT, I tried adding these into my Nvim config, but they didn't help:
vim.g.ale_echo_cursor
= 0vim.g.ale_hover_cursor
= 0vim.g.ale_cursor_detail
= 0So I turned on debug logging and started tracing the code to see where it came from. Here's the traced callstack:
cursor.vim : ale#cursor#Echom : 17
cursor.vim : ale#cursor#TruncatedEcho : 41
hover.vim : ale#hover#HandleLSPResponse : 250
hover.vim : s:OnReady : 284
hover.vim : ale#hover#Show : 335
hover.vim : ale#hover#ShowTruncatedMessageAtCursor : 363
events.vim : ale#events#Init : 218
Specifically, after the initialization register the hover callback here on line 218 of
events.vim
:ale/autoload/ale/events.vim
Lines 217 to 219 in a7ef181
... the
ale#hover#ShowTruncatedMessageAtCursor
function does not check for theg:ale_hover_cursor
anymore:ale/autoload/ale/hover.vim
Lines 350 to 371 in a7ef181
In other words, changing this variable after the callback is registered won't alter ALE's behavior. I am reporting this as a "bug" because this is not my expected behavior. In ALE's documentations, we can set variables in Lazy's
config
section:ale/README.md
Lines 296 to 312 in a7ef181
However, setting
vim.g.ale_hover_cursor
in theconfig
callback function doesn't really work:It has to be set before
require('lazy').setup()
is executed, so I think this is a bit counterintuitive. Perhaps it'll be better to add another check for the variable inale#hover#ShowTruncatedMessageAtCursor
or somewhere that makes it possible to changeale_hover_cursor
on the fly without doingALEToggle
twice?In the event this won't be fixed, for anyone that's having the same issue, just do
vim.g.ale_hover_cursor = 0
beforerequire('lazy').setup()
and it should be fine.Reproducing the bug
echom
command pops up.:ALEInfo
Expand
The text was updated successfully, but these errors were encountered: