aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorGeorge Zhao <zhaozg@aliyun.com>2020-04-17 00:30:03 +0800
committerGitHub <noreply@github.com>2020-04-16 18:30:03 +0200
commit51b4fc4778896775da5854fe6a04d00445b72919 (patch)
treeb269c16d5b8da20573cd7ecb913611c5f500a079 /runtime/lua/vim/lsp/util.lua
parente8269a3ab5f4505f27997b46b0eaf9464d186cf9 (diff)
downloadrneovim-51b4fc4778896775da5854fe6a04d00445b72919.tar.gz
rneovim-51b4fc4778896775da5854fe6a04d00445b72919.tar.bz2
rneovim-51b4fc4778896775da5854fe6a04d00445b72919.zip
lsp: provide a default for missing reference kind (#12127)
Fix #12122 >Error executing vim.schedule lua callback: /usr/local/share/nvim/runtime/lua/vim/lsp/util.lua:560: Expected lua string Some lsp server(e.g. https://github.com/bash-lsp/bash-language-server) not have kind in reference, reference["kind"] is nil
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 5dd010f2a4..1a8d7dc084 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -725,7 +725,8 @@ do
[protocol.DocumentHighlightKind.Read] = "LspReferenceRead";
[protocol.DocumentHighlightKind.Write] = "LspReferenceWrite";
}
- highlight_range(bufnr, reference_ns, document_highlight_kind[reference["kind"]], start_pos, end_pos)
+ local kind = reference["kind"] or protocol.DocumentHighlightKind.Text
+ highlight_range(bufnr, reference_ns, document_highlight_kind[kind], start_pos, end_pos)
end
end