neovim

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

commit 02289ab898575368eeaa234bbd78725f8463044c
parent 103f10d901423637a80a887a58949bc582b44cae
Author: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Date:   Fri, 12 Aug 2022 10:10:03 +0200

fix(lsp): fix nil value error in get_group (#19735)

`server_capabilities` can be nil until the server is initialized.
Reproduced with:

    vim.lsp.stop_client(vim.lsp.start_client {
      cmd = { vim.v.progpath, '-es', '-u', 'NONE', '--headless' };
    })
Diffstat:
Mruntime/lua/vim/lsp.lua | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua @@ -400,7 +400,8 @@ do ---@return CTGroup local function get_group(client) local allow_inc_sync = if_nil(client.config.flags.allow_incremental_sync, true) - local change_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change') + local change_capability = + vim.tbl_get(client.server_capabilities or {}, 'textDocumentSync', 'change') local sync_kind = change_capability or protocol.TextDocumentSyncKind.None if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then sync_kind = protocol.TextDocumentSyncKind.Full