From 8b442ab6296435ae3a949b70b0abac02d75b8741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 18 Apr 2024 15:03:36 +0800 Subject: =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=89=20merge=20=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=EF=BC=8C=E5=88=99=E8=B7=B3=E8=BF=87=20`duplicate-doc-?= =?UTF-8?q?alias`=20=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/core/diagnostics/duplicate-doc-alias.lua | 4 +++- script/parser/luadoc.lua | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'script') 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 { -- cgit v1.2.3