aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2020-02-18 23:38:52 -0800
committerGitHub <noreply@github.com>2020-02-18 23:38:52 -0800
commite8f160c82f8d4809320699630e07a7e5f4537e77 (patch)
treed4b6c45adac6dc5cffe3623c298da7fdd673fc08 /runtime/lua/vim/lsp.lua
parent521b79c0f85625f99ff626935484a1225360f820 (diff)
parentf3d4ddd0f8b654d58fb4653d88ac7f652e3ad364 (diff)
downloadrneovim-e8f160c82f8d4809320699630e07a7e5f4537e77.tar.gz
rneovim-e8f160c82f8d4809320699630e07a7e5f4537e77.tar.bz2
rneovim-e8f160c82f8d4809320699630e07a7e5f4537e77.zip
Merge #11895 'lsp: fix textDocument/completion handling'
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 94f0d62d8d..bc0da25ae5 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -945,12 +945,14 @@ function lsp.omnifunc(findstart, base)
-- Get the start position of the current keyword
local textMatch = vim.fn.match(line_to_cursor, '\\k*$')
+ local prefix = line_to_cursor:sub(textMatch+1)
+
local params = util.make_position_params()
local items = {}
lsp.buf_request(bufnr, 'textDocument/completion', params, function(err, _, result)
if err or not result then return end
- local matches = util.text_document_completion_list_to_complete_items(result)
+ local matches = util.text_document_completion_list_to_complete_items(result, prefix)
-- TODO(ashkan): is this the best way to do this?
vim.list_extend(items, matches)
vim.fn.complete(textMatch+1, items)