mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
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' }; })
This commit is contained in:

committed by
GitHub

parent
103f10d901
commit
02289ab898
@@ -400,7 +400,8 @@ do
|
|||||||
---@return CTGroup
|
---@return CTGroup
|
||||||
local function get_group(client)
|
local function get_group(client)
|
||||||
local allow_inc_sync = if_nil(client.config.flags.allow_incremental_sync, true)
|
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
|
local sync_kind = change_capability or protocol.TextDocumentSyncKind.None
|
||||||
if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then
|
if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then
|
||||||
sync_kind = protocol.TextDocumentSyncKind.Full
|
sync_kind = protocol.TextDocumentSyncKind.Full
|
||||||
|
Reference in New Issue
Block a user