Skip to content

Commit bf73e63

Browse files
committed
Enhance source handling in find-source.lua and introduce virtual node marking in luadoc.lua. Skip virtual sources during function checks and ensure documentation nodes are marked as virtual for better processing.
1 parent 996e21a commit bf73e63

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

script/core/find-source.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ return function (state, position, accept)
1515
local len = math.huge
1616
local result
1717
guide.eachSourceContain(state.ast, position, function (source)
18+
if source.virtual then
19+
return
20+
end
1821
if source.type == 'function' then
1922
if not isValidFunctionPos(source, position) then
2023
return

script/parser/luadoc.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,14 @@ local function luadoc(state)
23082308
bindDocs(state)
23092309
end
23102310

2311+
local function markVirtual(node)
2312+
if not node then
2313+
return
2314+
end
2315+
node.virtual = true
2316+
guide.eachChild(node, markVirtual)
2317+
end
2318+
23112319
return {
23122320
buildAndBindDoc = function (ast, src, comment, group)
23132321
local doc = buildLuaDoc(comment)
@@ -2317,6 +2325,7 @@ return {
23172325
doc.special = src
23182326
doc.originalComment = comment
23192327
doc.virtual = true
2328+
markVirtual(doc)
23202329
doc.specialBindGroup = group
23212330
ast.state.pluginDocs = pluginDocs
23222331
return doc

0 commit comments

Comments
 (0)