aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/protocol.lua
diff options
context:
space:
mode:
authorRaphael <glepnir@neovim.pro>2023-07-01 18:42:37 +0800
committerGitHub <noreply@github.com>2023-07-01 03:42:37 -0700
commitba8f19ebb67ca27d746f4b1cd902ab3d807eace3 (patch)
treed32c725a4b26c0ddffb02c88ba33aeb25a669770 /runtime/lua/vim/lsp/protocol.lua
parent11844dde81c41bded54f2383b57f8eef406f2736 (diff)
downloadrneovim-ba8f19ebb67ca27d746f4b1cd902ab3d807eace3.tar.gz
rneovim-ba8f19ebb67ca27d746f4b1cd902ab3d807eace3.tar.bz2
rneovim-ba8f19ebb67ca27d746f4b1cd902ab3d807eace3.zip
fix(lsp): lint warnings, default offset_encoding #24046
- fix lint / analysis warnings - locations_to_items(): get default offset_encoding from active client - character_offset(): get default offset_encoding from active client
Diffstat (limited to 'runtime/lua/vim/lsp/protocol.lua')
-rw-r--r--runtime/lua/vim/lsp/protocol.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index ea38bfe237..27da891656 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -880,7 +880,7 @@ end
--- Creates a normalized object describing LSP server capabilities.
---@param server_capabilities table Table of capabilities supported by the server
----@return table Normalized table of capabilities
+---@return table|nil Normalized table of capabilities
function protocol.resolve_capabilities(server_capabilities)
local TextDocumentSyncKind = protocol.TextDocumentSyncKind
local textDocumentSync = server_capabilities.textDocumentSync
@@ -898,7 +898,8 @@ function protocol.resolve_capabilities(server_capabilities)
elseif type(textDocumentSync) == 'number' then
-- Backwards compatibility
if not TextDocumentSyncKind[textDocumentSync] then
- return nil, 'Invalid server TextDocumentSyncKind for textDocumentSync'
+ vim.notify('Invalid server TextDocumentSyncKind for textDocumentSync', vim.log.levels.ERROR)
+ return nil
end
server_capabilities.textDocumentSync = {
openClose = true,
@@ -910,7 +911,11 @@ function protocol.resolve_capabilities(server_capabilities)
},
}
elseif type(textDocumentSync) ~= 'table' then
- return nil, string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync))
+ vim.notify(
+ string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync)),
+ vim.log.levels.ERROR
+ )
+ return nil
end
return server_capabilities
end