summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-11 19:46:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-11 19:46:54 +0800
commit644b1a4e9f256f78bef75d288cba7a02c75ddfb7 (patch)
tree40b788fd71d7e12db52543f06531c5c9ad94695a
parent6dcde32efe1c1380af6edd49f31e748aa2b48b90 (diff)
downloadlua-language-server-644b1a4e9f256f78bef75d288cba7a02c75ddfb7.zip
doc.type 支持 vararg
-rw-r--r--script-beta/core/diagnostics/undefined-doc-name.lua3
-rw-r--r--script-beta/parser/luadoc.lua24
2 files changed, 27 insertions, 0 deletions
diff --git a/script-beta/core/diagnostics/undefined-doc-name.lua b/script-beta/core/diagnostics/undefined-doc-name.lua
index 07894a54..5c1e8fbf 100644
--- a/script-beta/core/diagnostics/undefined-doc-name.lua
+++ b/script-beta/core/diagnostics/undefined-doc-name.lua
@@ -44,6 +44,9 @@ return function (uri, callback)
return
end
local name = source[1]
+ if name == '...' then
+ return
+ end
if hasNameOfClassOrAlias(name)
or hasNameOfGeneric(name, source) then
return
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua
index d71a7b50..94ddd37e 100644
--- a/script-beta/parser/luadoc.lua
+++ b/script-beta/parser/luadoc.lua
@@ -53,6 +53,7 @@ Symbol <- ({} {
/ '('
/ ')'
/ '?'
+ / '...'
} {})
-> Symbol
]], {
@@ -430,6 +431,19 @@ function parseType(parent)
if not result.start then
result.start = typeEnum.start
end
+ elseif tp == 'symbol' and content == '...' then
+ nextToken()
+ local vararg = {
+ type = 'doc.type.name',
+ start = getStart(),
+ finish = getFinish(),
+ parent = result,
+ [1] = content,
+ }
+ result.types[#result.types+1] = vararg
+ if not result.start then
+ result.start = vararg.start
+ end
end
if not checkToken('symbol', '|', 1) then
break
@@ -678,6 +692,14 @@ local function parseOverload()
return result
end
+local function parseDeprecated()
+ return {
+ type = 'doc.deprecated',
+ start = getFinish(),
+ finish = getFinish(),
+ }
+end
+
local function convertTokens()
local tp, text = nextToken()
if not tp then
@@ -709,6 +731,8 @@ local function convertTokens()
return parseVararg()
elseif text == 'overload' then
return parseOverload()
+ elseif text == 'deprecated' then
+ return parseDeprecated()
end
end