Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions script/core/find-source.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ return function (state, position, accept)
local len = math.huge
local result
guide.eachSourceContain(state.ast, position, function (source)
if source.virtual then
return
end
if source.type == 'function' then
if not isValidFunctionPos(source, position) then
return
Expand Down
9 changes: 9 additions & 0 deletions script/parser/luadoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,14 @@ local function luadoc(state)
bindDocs(state)
end

local function markVirtual(node)
if not node then
return
end
node.virtual = true
guide.eachChild(node, markVirtual)
end

return {
buildAndBindDoc = function (ast, src, comment, group)
local doc = buildLuaDoc(comment)
Expand All @@ -2317,6 +2325,7 @@ return {
doc.special = src
doc.originalComment = comment
doc.virtual = true
markVirtual(doc)
Comment on lines 2319 to 2327

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

你好,markVirtual 函数的第一行就是 node.virtual = true,所以 doc.virtual = true 这一行是多余的。我们可以把这两行合并为一行,让代码更简洁。

            markVirtual(doc)

doc.specialBindGroup = group
ast.state.pluginDocs = pluginDocs
return doc
Expand Down
Loading