summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-25 22:41:52 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-25 22:41:52 +0800
commitc5ac7aa810c1f39c3c09de02b7d43be88e87b1f4 (patch)
treeb4244b0f1c4b10a985c241d0d67b08db94f4b739 /script/core
parent1e3c7a0c12d215fc5c61dff6e8f2091a678962ff (diff)
parentf6b9b0e94764b7f950a4a0e7c41df12a75448edf (diff)
downloadlua-language-server-c5ac7aa810c1f39c3c09de02b7d43be88e87b1f4.zip
Merge commit 'f6b9b0e94764b7f950a4a0e7c41df12a75448edf' into 3.0
Diffstat (limited to 'script/core')
-rw-r--r--script/core/semantic-tokens.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index bb6282a4..ef426633 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -817,18 +817,17 @@ 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+',
- type = define.TokenTypes.comment,
+ start = comm.start + #head + 1,
+ finish = comm.start + #head + 2 + #comm.text:match('%S*', #head + 1),
+ type = define.TokenTypes.keyword,
modifieres = define.TokenModifiers.documentation,
}
else