Skip to content

Commit 703bdbb

Browse files
authored
Merge pull request #3285 from ushen-pyj/master
插件问题修复
2 parents fe72ef9 + 5335a18 commit 703bdbb

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
5+
* `FIX` Plugin virtual comment style and behavior issues
56
* `NEW` Support Lua 5.5
67
* `FIX` Incorrect generation of function signatures with tuple-parameters
78
* `NEW` Doc output now contains file paths for `@alias` and `@enum` types

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 & 1 deletion
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)
@@ -2316,7 +2324,7 @@ return {
23162324
pluginDocs[#pluginDocs+1] = doc
23172325
doc.special = src
23182326
doc.originalComment = comment
2319-
doc.virtual = true
2327+
markVirtual(doc)
23202328
doc.specialBindGroup = group
23212329
ast.state.pluginDocs = pluginDocs
23222330
return doc

0 commit comments

Comments
 (0)