summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-26 13:07:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-26 13:07:47 +0800
commit55b303d0beb1b08b5a50488e0bbba075a49d965d (patch)
treeac55df0733e94652dee81b7fe3b31d16c8db5ddb /script/parser
parent84f4da78a9b07823f6d78409fea8d373b6fbc3b6 (diff)
downloadlua-language-server-55b303d0beb1b08b5a50488e0bbba075a49d965d.zip
trim tail comment
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/luadoc.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 53f0097d..80c8a732 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -842,6 +842,19 @@ local function convertTokens()
end
end
+local function trimTailComment(text)
+ if text:sub(1, 1) == '@' then
+ return text:sub(2)
+ end
+ if text:sub(1, 1) == '#' then
+ return text:sub(2)
+ end
+ if text:sub(1, 2) == '--' then
+ return text:sub(3)
+ end
+ return text
+end
+
local function buildLuaDoc(comment)
local text = comment.text
if text:sub(1, 1) ~= '-' then
@@ -868,7 +881,7 @@ local function buildLuaDoc(comment)
type = 'doc.tailcomment',
start = cstart + comment.start - 1,
finish = comment.finish,
- text = text:sub(cstart),
+ text = trimTailComment(text:sub(cstart)),
}
end
end