diff options
-rw-r--r-- | script/core/semantic-tokens.lua | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index afa1424b..6163cbbe 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -815,21 +815,29 @@ return function (uri, start, finish) end) for _, comm in ipairs(state.comms) do - if comm.type == 'comment.short' then - local head = comm.text:sub(1, 2) - if head == '-@' - or head == '-|' then - results[#results+1] = { - start = comm.start, - finish = comm.start + 3, - type = define.TokenTypes.comment, - } - results[#results+1] = { - start = comm.start + 3, - finish = comm.start + 2 + #comm.text:match '%S+', - type = define.TokenTypes.comment, - modifieres = define.TokenModifiers.documentation, - } + 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 + results[#results+1] = { + start = comm.start, + finish = comm.start + 3, + type = define.TokenTypes.comment, + } + results[#results+1] = { + start = comm.start + 3, + finish = comm.start + 2 + #comm.text:match '%S+', + type = define.TokenTypes.comment, + modifieres = define.TokenModifiers.documentation, + } + else + results[#results+1] = { + start = comm.start, + finish = comm.finish, + type = define.TokenTypes.comment, + } + end else results[#results+1] = { start = comm.start, @@ -837,12 +845,6 @@ return function (uri, start, finish) type = define.TokenTypes.comment, } end - else - results[#results+1] = { - start = comm.start, - finish = comm.finish, - type = define.TokenTypes.comment, - } end end |