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
This has been a problem for ages, I was even still on w0rp/ale. Before this problem, I had other problems, with the language server being immature, and I've been waiting for this problem to be fixed as well for a while, thinking the language server is still not quite ready at 1.0. I upgraded versions before reporting this to see if it solved my problems, but no. Here are the latest versions I'm now on:
I'm on Vim 8.2 (exact details on this paste). This problem didn't occur on my NeoVim, which sources my vimrc and shows completion docs without issue.
Describe the bug
LanguageClient-neovim clashes with ALE, but I have a PR for that on the ALE side (dense-analysis/ale#3719). The problem in this issue is that it only seems to display the error for some language servers and not others.
To Reproduce
You can try this with an empty Haskell file, by running:
vim -u vimrc.haskell Main.hs
and then typing Prelude., then pressing C-x C-o.
You can try this with an empty Ruby file, by running:
vim -u vimrc.ruby main.rb
and then typing Kernel., then pressing C-x C-o.
Current behavior
The error is displayed to the user when using Haskell Language Server, but not Solargraph.
See section entitled “Story” for how I verified that both language servers were exercising the error-throwing code path in LanguageClient-neovim, and that the error is definitely being generated in the case where it's not being reported.
Expected behavior
The error should be displayed to the user when using Haskell Language Server or Solargraph.
Story
I use both the Haskell Language Server, and the Solargraph Ruby language server. I have two minimal examples that you can reproduce what I'm about to describe with (you can combine the two into a single minimal vimrc for both languages, but it works even when only one language server is defined as well, to make the examples more minimal).
Make sure to run all this in an empty folder for best reproducibility. Also, wait a few seconds after opening the Haskell and Ruby files before attempting completion to let the language servers launch. It seems if you try to complete before the language server has launched, even after it's launched, a second completion won't work (possibly a bug in itself, but not what this report is about).
First of all, HLS throws an error when showing docs for autocompletion entries. The first attempt, it's:
Error detected while processing function <lambda>13[1]..DebounceHandleCompleteChanged[27]..<SNR>28_ShowCompletionItemDocumentation[28]..<SNR>28_OpenHoverPreview[101]..InsertLeave Autocommands for "*"..function ale#Queue[33]..<SNR>30_Lint[20]..ale#engine#RunLinters[4]..<SNR>42_GetLintFileValues[27]..<lambda>17[1]..<SNR>42_RunLinters[18]..<SNR>42_RunLinter[6]..<SNR>42_RunIfExecutable[43]..<SNR>42_RunJob[27]..ale#command#Run[17]..ale#command#FormatCommand[40]..<SNR>43_TemporaryFilename[6]..ale#filetypes#GuessExtension[1]..<SNR>79_GetCachedExtensionMap[2]..ale#filetypes#LoadExtensionMap:
line 3:
E930: Cannot use :redir inside execute()
Press ENTER or type command to continue
Error detected while processing function <lambda>13[1]..DebounceHandleCompleteChanged[27]..<SNR>28_ShowCompletionItemDocumentation[28]..<SNR>28_OpenHoverPreview[101]..InsertLeave Autocommands for "*"..function ale#Queue[33]..<SNR>30_Lint[20]..ale#engine#RunLinters[4]..<SNR>42_GetLintFileValues[27]..<lambda>17[1]..<SNR>42_RunLinters[18]..<SNR>42_RunLinter[6]..<SNR>42_RunIfExecutable[43]..<SNR>42_RunJob[27]..ale#command#Run:
line 17:
E714: List required
The second and further attempts (before restarting Vim, even on the same completion menu or after opening a new one), it's slightly different (which I believe is because the extension map mentioned in the error is no longer a blank hash, so it's using the now cached corrupt value (another bug, I can report separately if you like)this happens regardless of LanguageClient-neovim's involvement or not; see linked PR on ALE repo of course it does, the extension map I mentioned is in the ALE codebase):
Error detected while processing function <lambda>18[1]..DebounceHandleCompleteChanged[27]..<SNR>28_ShowCompletionItemDocumentation[28]..<SNR>28_OpenHoverPreview[101]..InsertLeave Autocommands for "*"..function ale#Queue[33]..<SNR>30_Lint[20]..ale#engine#RunLinters[4]..<SNR>42_GetLintFileValues[27]..<lambda>19[1]..<SNR>42_RunLinters[18]..<SNR>42_RunLinter[6]..<SNR>42_RunIfExecutable[43]..<SNR>42_RunJob[27]..ale#command#Run[17]..ale#command#FormatCommand[40]..<SNR>43_TemporaryFilename[6]..ale#filetypes#GuessExtension:
line 2:
E896: Argument of get() must be a List, Dictionary or Blob
Press ENTER or type command to continue
Error detected while processing function <lambda>18[1]..DebounceHandleCompleteChanged[27]..<SNR>28_ShowCompletionItemDocumentation[28]..<SNR>28_OpenHoverPreview[101]..InsertLeave Autocommands for "*"..function ale#Queue[33]..<SNR>30_Lint[20]..ale#engine#RunLinters[4]..<SNR>42_GetLintFileValues[27]..<lambda>19[1]..<SNR>42_RunLinters[18]..<SNR>42_RunLinter[6]..<SNR>42_RunIfExecutable[43]..<SNR>42_RunJob[27]..ale#command#Run:
line 17:
E714: List required
You can try this with an empty Haskell file, by running:
vim -u vimrc.haskell Main.hs
and then typing Prelude., then pressing C-x C-o.
After tracking down the source of the error, it seems an InsertLeave autocommand is executed for the documentation popup to allow plasticboy/vim-markdown plugin (if installed) to render the Markdown docs, but because ALE also have an InsertLeave event, the execute() calls that as well, thus triggering a nested :redir.
I'm not sure why this triggers an error for the Haskell Language Server and not Solargraph, but I noticed I could reproduce it myself by doing the following:
If I miss out the middle line (and any filetype works, not just markdown), the error doesn't occur. While I was trying to figure this out, I placed a throw a:filetype in the LanguageClient-neovim code right before the doautocmd InsertLeave line to see if the filetype mattered, and this was causing the Haskell Language Server to error with that line instead of on the line right after. However, Solargraph seems to work without any problems, even with the throw a:filetype line I added, which really confused me.
You can try this with an empty Ruby file, by running:
vim -u vimrc.ruby main.rb
and then typing Kernel., then pressing C-x C-o.
So I chucked the throw a:filetype line right before the if display_approach ==# 'float_win' to see if it was using a different display_approach. I'm not sure why it'd do that, as I'm pretty sure that's based on the Vim/NeoVim version, but that succeeded… kind of; it didn't throw the error, but it prevented Solargraph from showing the completion docs.
With Haskell Language Server, the docs are shown anyway, because the error happens after it's shown. With Solargraph, errors aren't shown at all, so I was moving it further back to see if it was even reaching that line, and it was, it just seems to ignore errors, but the fact that the error is thrown is evident from the fact that it prevents further execution, thus preventing the docs from being shown, even though the error is not reported to the user.
I could then even move the throw a:filetype line to right after the elseif display_approach ==# 'popup_win' line, which is the display_approach used by HLS, and it still prevents the docs from showing up, so it is using the same display_approach.
I have no idea why errors thrown would be shown or not shown to the user based on the particular language server used.
The text was updated successfully, but these errors were encountered:
habibalamin
changed the title
LanguageClient-neovim treats errors different depending on the language server
LanguageClient-neovim treats errors differently depending on the language server
Jun 19, 2021
Versions and Environment
This has been a problem for ages, I was even still on
w0rp/ale
. Before this problem, I had other problems, with the language server being immature, and I've been waiting for this problem to be fixed as well for a while, thinking the language server is still not quite ready at1.0
. I upgraded versions before reporting this to see if it solved my problems, but no. Here are the latest versions I'm now on:languageclient
binary:languageclient 0.1.161
LanguageClient-neovim
plugin:a42594c
bee8eccb
haskell-language-server-wrapper
binary:0.40.4
I'm on Vim 8.2 (exact details on this paste). This problem didn't occur on my NeoVim, which sources my
vimrc
and shows completion docs without issue.Describe the bug
LanguageClient-neovim clashes with ALE, but I have a PR for that on the ALE side (dense-analysis/ale#3719). The problem in this issue is that it only seems to display the error for some language servers and not others.
To Reproduce
You can try this with an empty Haskell file, by running:
and then typing
Prelude.
, then pressingC-x C-o
.You can try this with an empty Ruby file, by running:
and then typing
Kernel.
, then pressingC-x C-o
.Current behavior
The error is displayed to the user when using Haskell Language Server, but not Solargraph.
See section entitled “Story” for how I verified that both language servers were exercising the error-throwing code path in LanguageClient-neovim, and that the error is definitely being generated in the case where it's not being reported.
Expected behavior
The error should be displayed to the user when using Haskell Language Server or Solargraph.
Story
I use both the Haskell Language Server, and the Solargraph Ruby language server. I have two minimal examples that you can reproduce what I'm about to describe with (you can combine the two into a single minimal
vimrc
for both languages, but it works even when only one language server is defined as well, to make the examples more minimal).Make sure to run all this in an empty folder for best reproducibility. Also, wait a few seconds after opening the Haskell and Ruby files before attempting completion to let the language servers launch. It seems if you try to complete before the language server has launched, even after it's launched, a second completion won't work (possibly a bug in itself, but not what this report is about).
For Ruby:
For Haskell:
First of all, HLS throws an error when showing docs for autocompletion entries. The first attempt, it's:
The second and further attempts (before restarting Vim, even on the same completion menu or after opening a new one), it's slightly different (
which I believe is because the extension map mentioned in the error is no longer a blank hash, so it's using the now cached corrupt value (another bug, I can report separately if you like)this happens regardless of LanguageClient-neovim's involvement or not; see linked PR on ALE repoof course it does, the extension map I mentioned is in the ALE codebase):You can try this with an empty Haskell file, by running:
and then typing
Prelude.
, then pressingC-x C-o
.After tracking down the source of the error, it seems an
InsertLeave
autocommand is executed for the documentation popup to allowplasticboy/vim-markdown
plugin (if installed) to render the Markdown docs, but because ALE also have anInsertLeave
event, theexecute()
calls that as well, thus triggering a nested:redir
.I'm not sure why this triggers an error for the Haskell Language Server and not Solargraph, but I noticed I could reproduce it myself by doing the following:
If I miss out the middle line (and any filetype works, not just
markdown
), the error doesn't occur. While I was trying to figure this out, I placed athrow a:filetype
in theLanguageClient-neovim
code right before thedoautocmd InsertLeave
line to see if the filetype mattered, and this was causing the Haskell Language Server to error with that line instead of on the line right after. However, Solargraph seems to work without any problems, even with thethrow a:filetype
line I added, which really confused me.You can try this with an empty Ruby file, by running:
and then typing
Kernel.
, then pressingC-x C-o
.So I chucked the
throw a:filetype
line right before theif display_approach ==# 'float_win'
to see if it was using a differentdisplay_approach
. I'm not sure why it'd do that, as I'm pretty sure that's based on the Vim/NeoVim version, but that succeeded… kind of; it didn't throw the error, but it prevented Solargraph from showing the completion docs.With Haskell Language Server, the docs are shown anyway, because the error happens after it's shown. With Solargraph, errors aren't shown at all, so I was moving it further back to see if it was even reaching that line, and it was, it just seems to ignore errors, but the fact that the error is thrown is evident from the fact that it prevents further execution, thus preventing the docs from being shown, even though the error is not reported to the user.
I could then even move the
throw a:filetype
line to right after theelseif display_approach ==# 'popup_win'
line, which is thedisplay_approach
used by HLS, and it still prevents the docs from showing up, so it is using the samedisplay_approach
.I have no idea why errors thrown would be shown or not shown to the user based on the particular language server used.
The text was updated successfully, but these errors were encountered: