Skip to content

Commit 5c28cf4

Browse files
committed
fix(language-core): slot exp formatting virtual code syntax incorrect
1 parent ef92423 commit 5c28cf4

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/language-core/lib/plugins/vue-template-inline-ts.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ const plugin: VueLanguagePlugin = ctx => {
113113
: formatBrackets.normal
114114
);
115115
}
116+
else if (prop.name === 'slot') {
117+
addFormatCodes(
118+
prop.exp.content,
119+
prop.exp.loc.start.offset,
120+
formatBrackets.params
121+
);
122+
}
116123
else {
117124
addFormatCodes(
118125
prop.exp.content,
@@ -149,11 +156,11 @@ const plugin: VueLanguagePlugin = ctx => {
149156
let start = leftExpressionRange.start;
150157
let end = source.loc.start.offset + source.content.length;
151158
while (templateContent[start - 1] === ' ' || templateContent[start - 1] === '(') {
152-
start--;
153-
}
159+
start--;
160+
}
154161
while (templateContent[end] === ' ' || templateContent[end] === ')') {
155-
end++;
156-
}
162+
end++;
163+
}
157164
addFormatCodes(
158165
templateContent.slice(start, end),
159166
start,

0 commit comments

Comments
 (0)