aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2022-08-12 10:10:03 +0200
committerGitHub <noreply@github.com>2022-08-12 10:10:03 +0200
commit02289ab898575368eeaa234bbd78725f8463044c (patch)
treed0f7782955a9f31bd95dd3b13dc02287a199bbd1
parent103f10d901423637a80a887a58949bc582b44cae (diff)
downloadrneovim-02289ab898575368eeaa234bbd78725f8463044c.tar.gz
rneovim-02289ab898575368eeaa234bbd78725f8463044c.tar.bz2
rneovim-02289ab898575368eeaa234bbd78725f8463044c.zip
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' }; })
-rw-r--r--runtime/lua/vim/lsp.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 2c62e87513..8d4f388e23 100644
--- 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