Skip to content

Commit

Permalink
Merge pull request #2488 from fesily/Never-sematic-virtual-ast-and-co…
Browse files Browse the repository at this point in the history
…mment

Never sematic virtual ast and comment
  • Loading branch information
sumneko authored Jan 18, 2024
2 parents 34319c7 + 21da40b commit 06cad0c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions script/core/semantic-tokens.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 '^@()')
Expand Down

0 comments on commit 06cad0c

Please sign in to comment.