Skip to content

Commit

Permalink
fix(language-core): map v-slot correctly to report error when missi…
Browse files Browse the repository at this point in the history
…ng default slot
  • Loading branch information
KazariEX committed Dec 23, 2024
1 parent b82461d commit 4693383
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/language-core/lib/codegen/template/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,24 +495,16 @@ function* generateComponentSlot(
false,
true
);
yield ': __VLS_thisSlot';
}
else {
yield `default: `;
yield* wrapWith(
slotDir.loc.start.offset,
slotDir.loc.start.offset + (
slotDir.loc.source.startsWith('#')
? '#'.length
: slotDir.loc.source.startsWith('v-slot:')
? 'v-slot:'.length
: 0
),
slotDir.loc.start.offset + (slotDir.rawName?.length ?? 0),
ctx.codeFeatures.withoutHighlightAndCompletion,
`__VLS_thisSlot`
`default`
);
}
yield `} = ${componentCtxVar}.slots!${endOfLine}`;
yield `: __VLS_thisSlot } = ${componentCtxVar}.slots!${endOfLine}`;

if (slotDir?.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
const slotAst = createTsAst(options.ts, slotDir, `(${slotDir.exp.content}) => {}`);
Expand Down

0 comments on commit 4693383

Please sign in to comment.