summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-18 17:51:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-18 17:51:43 +0800
commitbae4fa96a08158668d8b005f7885a774ad1c98fb (patch)
treea8931bdbc2150696ed3553538fe8b69b4ffa4ba8 /script
parentb45a90132438bb2d84b7376066e5ff409833a13f (diff)
downloadlua-language-server-bae4fa96a08158668d8b005f7885a774ad1c98fb.zip
update
Diffstat (limited to 'script')
-rw-r--r--script/core/completion.lua6
-rw-r--r--script/parser/newparser.lua2
2 files changed, 4 insertions, 4 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 51f1087e..46847540 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -842,8 +842,8 @@ local function checkProvideLocal(state, word, start, results)
end)
end
-local function checkFunctionArgByDocParam(state, word, start, results)
- local func = guide.eachSourceContain(state.ast, start, function (source)
+local function checkFunctionArgByDocParam(state, word, startPos, results)
+ local func = guide.eachSourceContain(state.ast, startPos, function (source)
if source.type == 'function' then
return source
end
@@ -863,7 +863,7 @@ local function checkFunctionArgByDocParam(state, word, start, results)
end
local firstArg = func.args and func.args[1]
if not firstArg
- or firstArg.start <= start and firstArg.finish >= start then
+ or firstArg.start <= startPos and firstArg.finish >= startPos then
local firstParam = params[1]
if firstParam and matchKey(word, firstParam.param[1]) then
local label = {}
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index 99518261..7955a5c3 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -2131,7 +2131,6 @@ local function parseFunction(isLocal, isAction)
params.finish = lastRightPosition()
params.parent = func
func.args = params
- func.finish = params.finish
end
skipSpace()
if Tokens[Index + 1] == ')' then
@@ -2143,6 +2142,7 @@ local function parseFunction(isLocal, isAction)
Index = Index + 2
skipSpace()
else
+ func.finish = lastRightPosition()
if params then
params.finish = func.finish
end