Skip to content

Commit 42355fc

Browse files
committed
fix(language-core): handle parentheses in v-for exp
1 parent aa0d1fe commit 42355fc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ const plugin: VueLanguagePlugin = ctx => {
146146
const { leftExpressionRange, leftExpressionText } = parseVForNode(node);
147147
const { source } = node.parseResult;
148148
if (leftExpressionRange && leftExpressionText && source.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
149-
const start = leftExpressionRange.start;
150-
const end = source.loc.start.offset + source.content.length;
149+
let start = leftExpressionRange.start;
150+
let end = source.loc.start.offset + source.content.length;
151+
while (templateContent[start - 1] === ' ' || templateContent[start - 1] === '(') start--;
152+
while (templateContent[end] === ' ' || templateContent[end] === ')') end++;
151153
addFormatCodes(
152154
templateContent.slice(start, end),
153155
start,

0 commit comments

Comments
 (0)