diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2024-04-18 15:03:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2024-04-18 15:03:36 +0800 |
commit | 8b442ab6296435ae3a949b70b0abac02d75b8741 (patch) | |
tree | 34ac5a8b116a56de4da81060c3474dc68c13e209 /script | |
parent | 1b3a03e310e2751edbd49709a2bba1e34caeb9f2 (diff) | |
download | lua-language-server-8b442ab6296435ae3a949b70b0abac02d75b8741.zip |
如果有 merge 属性,则跳过 `duplicate-doc-alias` 检查
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/duplicate-doc-alias.lua | 4 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/script/core/diagnostics/duplicate-doc-alias.lua b/script/core/diagnostics/duplicate-doc-alias.lua index 360358e4..6d8593ca 100644 --- a/script/core/diagnostics/duplicate-doc-alias.lua +++ b/script/core/diagnostics/duplicate-doc-alias.lua @@ -15,6 +15,7 @@ return function (uri, callback) return end + local merged = {} local cache = {} for _, doc in ipairs(state.ast.docs) do if doc.type == 'doc.alias' @@ -36,10 +37,11 @@ return function (uri, callback) finish = otherDoc.finish, uri = guide.getUri(otherDoc), } + merged[name] = merged[name] or vm.docHasAttr(otherDoc, 'merge') end end end - if #cache[name] > 1 then + if not merged[name] and #cache[name] > 1 then callback { start = (doc.alias or doc.enum).start, finish = (doc.alias or doc.enum).finish, diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 242b878e..bbffed25 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1026,6 +1026,7 @@ local docSwitch = util.switch() local result = { type = 'doc.alias', } + result.docAttr = parseDocAttr() result.alias = parseName('doc.alias.name', result) if not result.alias then pushWarning { |