From 75958614871dc316759f826d0f82b26442bbc03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 24 Nov 2021 15:47:34 +0800 Subject: resolve #655 --- script/core/completion/completion.lua | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'script/core/completion/completion.lua') diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index a766cccc..dadc46ca 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -718,15 +718,6 @@ local function checkCommon(state, word, position, results) end end -local function isInString(state, position) - return guide.eachSourceContain(state.ast, position, function (source) - if source.type == 'string' - and source.start < position then - return true - end - end) -end - local function checkKeyWord(state, start, position, word, hasSpace, afterLocal, results) local text = state.lua local snipType = config.get 'Lua.completion.keywordSnippet' @@ -1204,7 +1195,7 @@ local function isFuncArg(state, position) end local function trySpecial(state, position, results) - if isInString(state, position) then + if guide.isInString(state.ast, position) then checkUri(state, position, results) checkEqualEnumInString(state, position, results) return @@ -1238,7 +1229,7 @@ local function tryWord(state, position, triggerCharacter, results) startPos = guide.offsetToPosition(state, start - 1) end local hasSpace = triggerCharacter ~= nil and finish ~= offset - if isInString(state, position) then + if guide.isInString(state.ast, position) then if not hasSpace then if #results == 0 then checkCommon(state, word, position, results) @@ -1284,7 +1275,7 @@ local function trySymbol(state, position, results) if not symbol then return nil end - if isInString(state, position) then + if guide.isInString(state.ast, position) then return nil end local startPos = guide.offsetToPosition(state, start) @@ -2045,9 +2036,7 @@ local function tryCompletions(state, position, triggerCharacter, results) tryComment(state, position, results) return end - if postfix(state, position, results) then - return - end + postfix(state, position, results) trySpecial(state, position, results) tryCallArg(state, position, results) tryTable(state, position, results) -- cgit v1.2.3