diff options
Diffstat (limited to 'server/src/method/textDocument/completion.lua')
-rw-r--r-- | server/src/method/textDocument/completion.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/src/method/textDocument/completion.lua b/server/src/method/textDocument/completion.lua index 25cb155a..1e9030b8 100644 --- a/server/src/method/textDocument/completion.lua +++ b/server/src/method/textDocument/completion.lua @@ -30,13 +30,15 @@ local function findStartPos(pos, buf) end local function findWord(position, text) + local word = text for i = position-1, 1, -1 do local c = text:sub(i, i) if not c:find '%w' then - return text:sub(i+1, position) + word = text:sub(i+1, position) + break end end - return text:sub(1, position) + return word:match('^(%w*)') end return function (lsp, params) |