diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-24 16:17:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-24 16:17:39 +0800 |
commit | 2121da2d2b18c258a68528374922994776c105da (patch) | |
tree | ec89c86a324a01591c2c7216f2f75212271f48b7 | |
parent | b667155e516e779f12b4e393f139d68fb0920709 (diff) | |
download | lua-language-server-2121da2d2b18c258a68528374922994776c105da.zip |
#101 spaces can be inserted between `---` and `@`
-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 b31c4baf..2f29d4eb 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -831,7 +831,8 @@ local function buildLuaDoc(comment) if text:sub(1, 1) ~= '-' then return end - if text:sub(2, 2) ~= '@' then + local _, startPos = text:find('%s*@', 2) + if not startPos then return { type = 'doc.comment', start = comment.start, @@ -839,16 +840,16 @@ local function buildLuaDoc(comment) comment = comment, } end - local finishPos = text:find('@', 3) + local finishPos = text:find('@', startPos + 1) local doc, lastComment if finishPos then - doc = text:sub(3, finishPos - 1) + doc = text:sub(startPos + 1, finishPos - 1) lastComment = text:sub(finishPos) else - doc = text:sub(3) + doc = text:sub(startPos + 1) end - parseTokens(doc, comment.start + 1) + parseTokens(doc, comment.start + startPos - 1) local result = convertTokens() if result then result.comment = lastComment |