Skip to content

Commit

Permalink
Update element.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Oct 23, 2024
1 parent 1e84ae7 commit c75b33b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/language-core/lib/codegen/template/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export function* generateComponent(
exp: CompilerDOM.ElementNode | CompilerDOM.ExpressionNode;
tag: string;
offsets: [number, number | undefined];
isComponentIsShorthand?: boolean;
} | undefined;

if (isComponentTag) {
Expand All @@ -63,11 +62,13 @@ export function* generateComponent(
&& prop.arg?.loc.source === 'is'
&& prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
) {
if (prop.arg.loc.end.offset === prop.exp.loc.end.offset) {
ctx.inlayHints.push(createVBindShorthandInlayHintInfo(prop.exp.loc, 'is'));
}
dynamicTagInfo = {
exp: prop.exp,
tag: prop.exp.content,
offsets: [prop.exp.loc.start.offset, undefined],
isComponentIsShorthand: prop.arg.loc.end.offset === prop.exp.loc.end.offset
};
props = props.filter(p => p !== prop);
break;
Expand Down Expand Up @@ -114,9 +115,6 @@ export function* generateComponent(
yield `]${endOfLine}`;
}
else if (dynamicTagInfo) {
if (dynamicTagInfo.isComponentIsShorthand) {
ctx.inlayHints.push(createVBindShorthandInlayHintInfo(dynamicTagInfo.exp.loc, 'is'));
}
yield `const ${var_originalComponent} = (`;
yield* generateInterpolation(
options,
Expand Down

0 comments on commit c75b33b

Please sign in to comment.