summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-30 18:11:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-31 17:57:25 +0800
commit83427096a606baedebb7c59af4e525e8a290f1eb (patch)
tree693c416ee96567e09c2533f16e7fea946d325636 /script/parser
parent79adf4a94669b5b278675ba172c9d407879ab438 (diff)
downloadlua-language-server-83427096a606baedebb7c59af4e525e8a290f1eb.zip
clean up code
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/luadoc.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 94544218..647a6bed 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -915,6 +915,7 @@ local function buildLuaDoc(comment)
type = 'doc.comment',
start = comment.start,
finish = comment.finish,
+ range = comment.finish,
comment = comment,
}
end
@@ -924,6 +925,7 @@ local function buildLuaDoc(comment)
parseTokens(doc, comment.start + startPos - 1)
local result = convertTokens()
if result then
+ result.range = comment.finish
local cstart = text:find('%S', result.finish - comment.start + 2)
if cstart and cstart < comment.finish then
result.comment = {
@@ -935,7 +937,17 @@ local function buildLuaDoc(comment)
end
end
- return result
+ if result then
+ return result
+ end
+
+ return {
+ type = 'doc.comment',
+ start = comment.start,
+ finish = comment.finish,
+ range = comment.finish,
+ comment = comment,
+ }
end
---当前行在注释doc前是否有代码