summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-01 13:46:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-01 13:46:03 +0800
commitae95f749532c2252c671d1b3cab73d7e18cf777c (patch)
treee422f684ee201cc4473e777985121a974f97bfeb /script
parent640fb9c3ec3164042d15fffecd88667a22d99f6f (diff)
downloadlua-language-server-ae95f749532c2252c671d1b3cab73d7e18cf777c.zip
improve field attribute
Diffstat (limited to 'script')
-rw-r--r--script/parser/luadoc.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 0e560b0d..040a9a9b 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -163,8 +163,9 @@ local function parseTokens(text, offset)
Ci = 0
end
-local function peekToken()
- return TokenTypes[Ci+1], TokenContents[Ci+1]
+local function peekToken(offset)
+ offset = offset or 1
+ return TokenTypes[Ci + offset], TokenContents[Ci + offset]
end
---@return string? tokenType
@@ -992,8 +993,12 @@ local docSwitch = util.switch()
if value == 'public'
or value == 'protected'
or value == 'private'
- or value == 'public'
or value == 'package' then
+ local tp2 = peekToken(1)
+ local tp3 = peekToken(2)
+ if tp2 == 'name' and not tp3 then
+ return false
+ end
result.visible = value
result.start = getStart()
return true