diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-03-22 16:15:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-03-22 16:15:16 +0800 |
commit | b8627365c0abe5a9d40c91f81b2aef7ea869faad (patch) | |
tree | d1634ad66931919067a9609fb645d99f576bb7ad /script/parser/luadoc.lua | |
parent | 5b6542e8ff276a195c502cc2479b53685429eb2e (diff) | |
download | lua-language-server-b8627365c0abe5a9d40c91f81b2aef7ea869faad.zip |
don't treat half string in comment as string
fix #2013
Diffstat (limited to 'script/parser/luadoc.lua')
-rw-r--r-- | script/parser/luadoc.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 545f9d95..2f5a8ad3 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1501,21 +1501,22 @@ end local function trimTailComment(text) local comment = text if text:sub(1, 1) == '@' then - comment = text:sub(2) + comment = util.trim(text:sub(2)) end if text:sub(1, 1) == '#' then - comment = text:sub(2) + comment = util.trim(text:sub(2)) end if text:sub(1, 2) == '--' then - comment = text:sub(3) + comment = util.trim(text:sub(3)) end - if comment:find '^%s*[\'"[]' then + if comment:find '^%s*[\'"[]' + and comment:find '[\'"%]]%s*$' then local state = compile(comment:gsub('^%s+', ''), 'String') if state and state.ast then comment = state.ast[1] end end - return comment + return util.trim(comment) end local function buildLuaDoc(comment) |