diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-07 16:47:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-07 16:47:10 +0800 |
commit | 1face5ab84618c03ad3077252ae289774ce7a816 (patch) | |
tree | e01a038c43f5f473a4bf657b538efedaaa980a01 /script/core | |
parent | 2107c1c82bccaaf2e2cce937412ef8d5e8741b45 (diff) | |
download | lua-language-server-1face5ab84618c03ad3077252ae289774ce7a816.zip |
fix #975
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/semantic-tokens.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index a4429e03..c5a77563 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -817,17 +817,16 @@ return function (uri, start, finish) for _, comm in ipairs(state.comms) do if start <= comm.start and comm.finish <= finish then if comm.type == 'comment.short' then - local head = comm.text:sub(1, 2) - if head == '-@' - or head == '-|' then + local head = comm.text:match '^%-%s*[@|]' + if head then results[#results+1] = { start = comm.start, - finish = comm.start + 3, + finish = comm.start + #head + 1, type = define.TokenTypes.comment, } results[#results+1] = { - start = comm.start + 3, - finish = comm.start + 2 + #comm.text:match '%S+', + start = comm.start + #head + 1, + finish = comm.start + #head + 2 + #comm.text:match('%S+', #head + 1), type = define.TokenTypes.keyword, modifieres = define.TokenModifiers.documentation, } |