summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2024-01-18 12:39:45 +0800
committerfesily <fesil@foxmail.com>2024-01-18 12:39:45 +0800
commit21da40b92c71c4242f27d861140729c65978ce64 (patch)
treea499ea73332d2fefd6b6b9a49374f18f297beaa3 /script/core
parentef7157c450254b0ee447960b0cb06d6f1b0dbaaa (diff)
downloadlua-language-server-21da40b92c71c4242f27d861140729c65978ce64.zip
Never sematic virtual ast and comment
Diffstat (limited to 'script/core')
-rw-r--r--script/core/semantic-tokens.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 4e1d8e00..e908ef7b 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -882,6 +882,10 @@ return function (uri, start, finish)
local n = 0
guide.eachSourceBetween(state.ast, start, finish, function (source) ---@async
+ -- skip virtual source
+ if source.virtual then
+ return
+ end
Care(source.type, source, options, results)
n = n + 1
if n % 100 == 0 then
@@ -890,6 +894,10 @@ return function (uri, start, finish)
end)
for _, comm in ipairs(state.comms) do
+ -- skip virtual comment
+ if comm.virtual then
+ return
+ end
if start <= comm.start and comm.finish <= finish then
local headPos = (comm.type == 'comment.short' and comm.text:match '^%-%s*[@|]()')
or (comm.type == 'comment.long' and comm.text:match '^@()')