From eba142e78bc01011d536dbeafe9e70ea6956d544 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 27 Dec 2024 15:43:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20hoisted=20mcdoc=20types=20?= =?UTF-8?q?losing=20their=20attributes=20(#1688)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mcdoc/src/binder/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/mcdoc/src/binder/index.ts b/packages/mcdoc/src/binder/index.ts index 80c6bd41f..030c10406 100644 --- a/packages/mcdoc/src/binder/index.ts +++ b/packages/mcdoc/src/binder/index.ts @@ -854,7 +854,10 @@ function convertEnum(node: EnumNode, ctx: McdocBinderContext): McdocType { // Return reference if the enum has been hoisted if (identifier && !ctx.isHoisting) { - return { kind: 'reference', path: `${ctx.moduleIdentifier}::${identifier.value}` } + return wrapType(node, { + kind: 'reference', + path: `${ctx.moduleIdentifier}::${identifier.value}`, + }, ctx) } // Shortcut if the typeDef has been added to the enum symbol. @@ -894,7 +897,10 @@ function convertStruct(node: StructNode, ctx: McdocBinderContext): McdocType { // Return reference if the struct has been hoisted if (identifier && !ctx.isHoisting) { - return { kind: 'reference', path: `${ctx.moduleIdentifier}::${identifier.value}` } + return wrapType(node, { + kind: 'reference', + path: `${ctx.moduleIdentifier}::${identifier.value}`, + }, ctx) } // Shortcut if the typeDef has been added to the struct symbol.