summaryrefslogtreecommitdiff
path: root/test/completion/init.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-02-09 13:39:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-02-09 13:39:42 +0800
commitd45931530be1a75d22ff675cd6e53535d9842d70 (patch)
treee9eeb71c6ace74057388de4ac979f1c4127f8f52 /test/completion/init.lua
parent7321df77c443853370cbb10acd619a0073c55a13 (diff)
downloadlua-language-server-d45931530be1a75d22ff675cd6e53535d9842d70.zip
fix completion
`triggerCharacter` is `nil` when typing letters and numbers
Diffstat (limited to 'test/completion/init.lua')
-rw-r--r--test/completion/init.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/completion/init.lua b/test/completion/init.lua
index 3d0c4df6..4ae185ca 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -73,11 +73,16 @@ function TEST(script)
local inputPos = catched['?'][1][2]
if ContinueTyping then
local triggerCharacter = script:sub(inputPos - 1, inputPos - 1)
+ if triggerCharacter == '\n'
+ or triggerCharacter:find '%w_' then
+ triggerCharacter = nil
+ end
core.completion('', inputPos, triggerCharacter)
end
local offset = guide.positionToOffset(state, inputPos)
local triggerCharacter = script:sub(offset, offset)
- if triggerCharacter == '\n' then
+ if triggerCharacter == '\n'
+ or triggerCharacter:find '%w_' then
triggerCharacter = nil
end
local result = core.completion('', inputPos, triggerCharacter)