neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 034d28c705ccb93dea27613cbf91ba3f9c1caaa7
parent 195d8496a03bf5a14f5d114d57d841b037d543c4
Author: Nicolas Hillegeer <nicolas@hillegeer.com>
Date:   Tue, 12 Jul 2022 03:37:01 +0200

fix(lsp): don't attach a client in lsp.start() if there is none (#19328)

vim.lsp.start_client() may fail (for example if the `cmd` is not
executable). It produces a nice error notification in this case. Passing
the `nil` value returned from an erroneous `vim.lsp.start_client()` call
into `vim.lsp.buf_attach_client()` causes a meaty param validate
exception message. Avoid this.
Diffstat:
Mruntime/lua/vim/lsp.lua | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua @@ -746,6 +746,9 @@ function lsp.start(config, opts) end end local client_id = lsp.start_client(config) + if client_id == nil then + return nil -- lsp.start_client will have printed an error + end lsp.buf_attach_client(bufnr, client_id) return client_id end