Skip to content

Commit

Permalink
fix(language-core): slot exp formatting virtual code syntax incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 3, 2025
1 parent ef92423 commit 5c28cf4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/language-core/lib/plugins/vue-template-inline-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ const plugin: VueLanguagePlugin = ctx => {
: formatBrackets.normal
);
}
else if (prop.name === 'slot') {
addFormatCodes(
prop.exp.content,
prop.exp.loc.start.offset,
formatBrackets.params
);
}
else {
addFormatCodes(
prop.exp.content,
Expand Down Expand Up @@ -149,11 +156,11 @@ const plugin: VueLanguagePlugin = ctx => {
let start = leftExpressionRange.start;
let end = source.loc.start.offset + source.content.length;
while (templateContent[start - 1] === ' ' || templateContent[start - 1] === '(') {
start--;
}
start--;
}
while (templateContent[end] === ' ' || templateContent[end] === ')') {
end++;
}
end++;
}
addFormatCodes(
templateContent.slice(start, end),
start,
Expand Down

0 comments on commit 5c28cf4

Please sign in to comment.