diff options
author | carsakiller <carsakiller@gmail.com> | 2024-05-25 03:36:29 +0000 |
---|---|---|
committer | carsakiller <carsakiller@gmail.com> | 2024-05-25 03:36:29 +0000 |
commit | 50ff3a41836e2d3ab872007b679151cf51d6659e (patch) | |
tree | ac0bf0713779bb0d9e2caa855f52b2eb688eb70a | |
parent | 459ac5c06ecca35d135217ca0892cc7787a91d33 (diff) | |
download | lua-language-server-50ff3a41836e2d3ab872007b679151cf51d6659e.zip |
fix: remove callback
-rw-r--r-- | script/core/completion/completion.lua | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index dc045474..e9257bea 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -1546,7 +1546,7 @@ local function tryWord(state, position, triggerCharacter, results) local env = guide.getENV(state.ast, startPos) if env then checkGlobal(state, word, startPos, position, env, false, results) - checkModule(state, word, startPos, results) + checkModule(state, word, startPos, results) end end end @@ -2256,7 +2256,8 @@ local function tryluaDocOfFunction(doc, results, pad) } end ----Checks for a lua symbol reference in comment and returns an async callback if found +---Checks for a lua symbol reference in comment +---@async local function trySymbolReference(state, position, results) local doc = getLuaDoc(state, position) if not doc then @@ -2274,15 +2275,12 @@ local function trySymbolReference(state, position, results) -- flip it back the right way around symbol = string.reverse(symbol) - ---@async - return function () - for _, match in ipairs(wssymbol(symbol)) do - results[#results+1] = { - label = match.name, - kind = define.CompletionItemKind.Class, - insertText = match.name - } - end + for _, match in ipairs(wssymbol(symbol)) do + results[#results+1] = { + label = match.name, + kind = define.CompletionItemKind.Class, + insertText = match.name + } end end end @@ -2358,12 +2356,8 @@ end ---@async local function tryCompletions(state, position, triggerCharacter, results) if getComment(state, position) then - local callback = trySymbolReference(state, position, results) - if callback then - callback() - else - tryComment(state, position, results) - end + trySymbolReference(state, position, results) + tryComment(state, position, results) tryLuaDoc(state, position, results) return end |