summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-11 17:12:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-11 17:12:18 +0800
commit6dcde32efe1c1380af6edd49f31e748aa2b48b90 (patch)
treed1bef13a48e13a36c409f9375acc5c9a2c9ed1d7
parent3f2c19d1990d858989d9c908964b93f99789f0e4 (diff)
downloadlua-language-server-6dcde32efe1c1380af6edd49f31e748aa2b48b90.zip
修正2个bug
-rw-r--r--script-beta/parser/luadoc.lua7
-rw-r--r--test-beta/diagnostics/init.lua10
2 files changed, 17 insertions, 0 deletions
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua
index 83ae940a..d71a7b50 100644
--- a/script-beta/parser/luadoc.lua
+++ b/script-beta/parser/luadoc.lua
@@ -146,10 +146,16 @@ local function checkToken(tp, content, offset)
end
local function getStart()
+ if Ci == 0 then
+ return Offset
+ end
return TokenStarts[Ci] + Offset
end
local function getFinish()
+ if Ci == 0 then
+ return Offset
+ end
return TokenFinishs[Ci] + Offset
end
@@ -395,6 +401,7 @@ function parseType(parent)
enums = {},
resumes = {},
}
+ result.start = getStart()
while true do
local tp, content = peekToken()
if not tp then
diff --git a/test-beta/diagnostics/init.lua b/test-beta/diagnostics/init.lua
index 4c21da69..4fe96ec4 100644
--- a/test-beta/diagnostics/init.lua
+++ b/test-beta/diagnostics/init.lua
@@ -748,3 +748,13 @@ function assert(v, message)
return v, message
end
]]
+
+TEST [[
+---@type string
+---|
+]]
+
+TEST [[
+---@type
+---| 'xx'
+]]