summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/completion/completion.lua8
-rw-r--r--test/completion/common.lua5
-rw-r--r--test/completion/init.lua7
3 files changed, 14 insertions, 6 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index 800c11a1..680b9a23 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -1254,11 +1254,9 @@ local function tryWord(state, position, triggerCharacter, results)
checkFunctionArgByDocParam(state, word, startPos, results)
else
local afterLocal = isAfterLocal(state, startPos)
- if triggerCharacter ~= nil then
- local stop = checkKeyWord(state, startPos, position, word, hasSpace, afterLocal, results)
- if stop then
- return
- end
+ local stop = checkKeyWord(state, startPos, position, word, hasSpace, afterLocal, results)
+ if stop then
+ return
end
if not hasSpace then
if afterLocal then
diff --git a/test/completion/common.lua b/test/completion/common.lua
index bfb987c6..818d0ac5 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -3074,3 +3074,8 @@ AAA = 1
<??>
]]
(EXISTS)
+
+TEST [[
+if<??>
+]]
+(EXISTS)
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)