diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-26 13:07:47 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-26 13:07:47 +0800 |
commit | 55b303d0beb1b08b5a50488e0bbba075a49d965d (patch) | |
tree | ac55df0733e94652dee81b7fe3b31d16c8db5ddb /script/parser | |
parent | 84f4da78a9b07823f6d78409fea8d373b6fbc3b6 (diff) | |
download | lua-language-server-55b303d0beb1b08b5a50488e0bbba075a49d965d.zip |
trim tail comment
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/luadoc.lua | 15 |
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 |