aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp/protocol.lua13
-rw-r--r--runtime/lua/vim/lsp/rpc.lua19
-rw-r--r--runtime/lua/vim/lsp/util.lua22
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua2
4 files changed, 36 insertions, 20 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 2773f59b45..70862320c5 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -632,15 +632,18 @@ function protocol.make_client_capabilities()
codeActionLiteralSupport = {
codeActionKind = {
- valueSet = {};
+ valueSet = vim.tbl_values(protocol.CodeActionKind);
};
};
};
completion = {
dynamicRegistration = false;
completionItem = {
+ -- Until we can actually expand snippet, move cursor and allow for true snippet experience,
+ -- this should be disabled out of the box.
+ -- However, users can turn this back on if they have a snippet plugin.
+ snippetSupport = false;
- snippetSupport = true;
commitCharactersSupport = false;
preselectSupport = false;
deprecatedSupport = false;
@@ -940,11 +943,9 @@ function protocol.resolve_capabilities(server_capabilities)
if server_capabilities.codeActionProvider == nil then
general_properties.code_action = false
- elseif type(server_capabilities.codeActionProvider) == 'boolean' then
+ elseif type(server_capabilities.codeActionProvider) == 'boolean'
+ or type(server_capabilities.codeActionProvider) == 'table' then
general_properties.code_action = server_capabilities.codeActionProvider
- elseif type(server_capabilities.codeActionProvider) == 'table' then
- -- TODO(ashkan) support CodeActionKind
- general_properties.code_action = false
else
error("The server sent invalid codeActionProvider")
end
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 749a51fecc..17c411f952 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -42,13 +42,28 @@ local function is_dir(filename)
end
local NIL = vim.NIL
+
+--@private
+local recursive_convert_NIL
+recursive_convert_NIL = function(v, tbl_processed)
+ if v == NIL then
+ return nil
+ elseif not tbl_processed[v] and type(v) == 'table' then
+ tbl_processed[v] = true
+ return vim.tbl_map(function(x)
+ return recursive_convert_NIL(x, tbl_processed)
+ end, v)
+ end
+
+ return v
+end
+
--@private
--- Returns its argument, but converts `vim.NIL` to Lua `nil`.
--@param v (any) Argument
--@returns (any)
local function convert_NIL(v)
- if v == NIL then return nil end
- return v
+ return recursive_convert_NIL(v, {})
end
--@private
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 775932c7fd..9ed19b938d 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -214,13 +214,16 @@ end
function M.apply_text_document_edit(text_document_edit)
local text_document = text_document_edit.textDocument
local bufnr = vim.uri_to_bufnr(text_document.uri)
- if text_document.version then
- -- `VersionedTextDocumentIdentifier`s version may be null https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
- if text_document.version ~= vim.NIL and M.buf_versions[bufnr] ~= nil and M.buf_versions[bufnr] > text_document.version then
- print("Buffer ", text_document.uri, " newer than edits.")
- return
- end
+
+ -- `VersionedTextDocumentIdentifier`s version may be null
+ -- https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
+ if text_document.version
+ and M.buf_versions[bufnr]
+ and M.buf_versions[bufnr] > text_document.version then
+ print("Buffer ", text_document.uri, " newer than edits.")
+ return
end
+
M.apply_text_edits(text_document_edit.edits, bufnr)
end
@@ -492,10 +495,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help)
--=== 0`. Whenever possible implementors should make an active decision about
--the active signature and shouldn't rely on a default value.
local contents = {}
- local active_signature = signature_help.activeSignature
- if active_signature == vim.NIL or active_signature == nil then
- active_signature = 0
- end
+ local active_signature = signature_help.activeSignature or 0
-- If the activeSignature is not inside the valid range, then clip it.
if active_signature >= #signature_help.signatures then
active_signature = 0
@@ -535,7 +535,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help)
}
--]=]
-- TODO highlight parameter
- if parameter.documentation and parameter.documentation ~= vim.NIL then
+ if parameter.documentation then
M.convert_input_to_markdown_lines(parameter.documentation, contents)
end
end
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index decde08019..6714bb6354 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -157,7 +157,7 @@ local function on_line_impl(self, buf, line)
a.nvim_buf_set_extmark(buf, ns, start_row, start_col,
{ end_line = end_row, end_col = end_col,
hl_group = hl,
- ephemeral = true
+ ephemeral = true,
})
end
if start_row > line then