diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-02 11:33:17 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-02 11:33:17 +0800 |
commit | 35b712381cf91294629f85c8598055f6b5babf06 (patch) | |
tree | ef71b8bd1b178893a04d95ecf9ccf8a671838b3a | |
parent | a08e06cf9e23e27e8f274710cbd45947579fa8c6 (diff) | |
download | lua-language-server-35b712381cf91294629f85c8598055f6b5babf06.zip |
`LuaDoc` compatible with `--@`
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/completion.lua | 7 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/changelog.md b/changelog.md index 27ae4251..e6682a13 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * `NEW` flush cache after 5 min * `NEW` `VSCode` help semantic color with market theme * `CHG` create/delete/rename files no longer reload workspace (only if client supports file operation protocol) +* `CHG` `LuaDoc`: compatible with `--@` * `FIX` `VSCode` settings * `FIX` [#368](https://github.com/sumneko/lua-language-server/issues/368) diff --git a/script/core/completion.lua b/script/core/completion.lua index 83842f45..33c8f70e 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -1378,8 +1378,7 @@ local function getLuaDoc(ast, offset) return nil end -local function tryLuaDocCate(line, results) - local word = line:sub(3) +local function tryLuaDocCate(word, results) for _, docType in ipairs { 'class', 'type', @@ -1644,9 +1643,9 @@ local function tryLuaDoc(ast, text, offset, results) return end -- 尝试 ---@$ - local cate = line:match('^-@(%a*)$') + local cate = line:match('^-?%s*@(%a*)$') if cate then - tryLuaDocCate(line, results) + tryLuaDocCate(cate, results) return end end diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 4512bc9e..fa1cc38b 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -915,7 +915,7 @@ end local function buildLuaDoc(comment) local text = comment.text - local _, startPos = text:find('^%-%s*@') + local _, startPos = text:find('^%-?%s*@') if not startPos then return { type = 'doc.comment', |