summaryrefslogtreecommitdiff
path: root/server/src/parser/ast.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-25 21:01:20 +0800
committersumneko <sumneko@hotmail.com>2019-04-25 21:01:20 +0800
commitd467b51cf4ce3b405fe131ddd75a6844e17797f3 (patch)
treebe33a3067862e7da605c3f9cafddc9e39f7ab787 /server/src/parser/ast.lua
parent3391ab935f18e928da414c19a84e7afc4acee779 (diff)
downloadlua-language-server-d467b51cf4ce3b405fe131ddd75a6844e17797f3.zip
参数自动完成
Diffstat (limited to 'server/src/parser/ast.lua')
-rw-r--r--server/src/parser/ast.lua43
1 files changed, 29 insertions, 14 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 7df7676d..f93870e4 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -559,42 +559,57 @@ local Defs = {
finish = start,
}
end,
- Function = function (start, arg, ...)
+ Function = function (start, argStart, arg, argFinish, ...)
local obj = {
- type = 'function',
- start = start,
- arg = arg,
+ type = 'function',
+ start = start,
+ arg = arg,
+ argStart = argStart - 1,
+ argFinish = argFinish,
...
}
local max = #obj
obj.finish = obj[max] - 1
obj[max] = nil
+ if obj.argFinish > obj.finish then
+ obj.argFinish = obj.finish
+ end
return obj
end,
- NamedFunction = function (start, name, arg, ...)
+ NamedFunction = function (start, name, argStart, arg, argFinish, ...)
local obj = {
- type = 'function',
- start = start,
- name = name,
- arg = arg,
+ type = 'function',
+ start = start,
+ name = name,
+ arg = arg,
+ argStart = argStart - 1,
+ argFinish = argFinish,
...
}
local max = #obj
obj.finish = obj[max] - 1
obj[max] = nil
+ if obj.argFinish > obj.finish then
+ obj.argFinish = obj.finish
+ end
return obj
end,
- LocalFunction = function (start, name, arg, ...)
+ LocalFunction = function (start, name, argStart, arg, argFinish, ...)
local obj = {
- type = 'localfunction',
- start = start,
- name = name,
- arg = arg,
+ type = 'localfunction',
+ start = start,
+ name = name,
+ arg = arg,
+ argStart = argStart - 1,
+ argFinish = argFinish,
...
}
local max = #obj
obj.finish = obj[max] - 1
obj[max] = nil
+ if obj.argFinish > obj.finish then
+ obj.argFinish = obj.finish
+ end
return obj
end,
Table = function (start, ...)