nvim-lspconfig shortcircuits if on_attach
contains vim.api.nvim_exec2
statements
#2731
Labels
bug
Something isn't working
Description
If the user defined
on_attach
functions contains avim.api.nvim_exec2
statement (see minimum repro example below), then nvim-lspconfig will mysteriously and without error stop execution on this line and not proceed:nvim-lspconfig/lua/lspconfig/configs.lua
Line 333 in dd11ba7
This is bad because the next couple of lines register the user passed
commands
:nvim-lspconfig/lua/lspconfig/configs.lua
Lines 335 to 340 in dd11ba7
So this means that the commands field is completely ignored, and this is the reason that my rust-tools had none of its commands on start up (took way too long to root cause 😳)
Neovim version
NVIM v0.9.0-dev-1319+g10baf8971
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Nvim-lspconfig version
dd11ba7
Operating system and version
Linux main 6.4.3-zen1-2-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 15 Jul 2023 20:18:15 +0000 x86_64 GNU/Linux
Affected language servers
all
Steps to reproduce
nvim -u min.lua sample.rs
(need a sample rust file to trigger rust_analyzer):SampleCommand
Actual behavior
E492: Not an editor command: SampleCommand
Expected behavior
hello world
i.e.
SampleCommand
was definedMinimal config
LSP log
see minimal lua
The text was updated successfully, but these errors were encountered: