Skip to content

Commit

Permalink
fix(language-core): handle parentheses in v-for exp
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 3, 2025
1 parent aa0d1fe commit 42355fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/language-core/lib/plugins/vue-template-inline-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ const plugin: VueLanguagePlugin = ctx => {
const { leftExpressionRange, leftExpressionText } = parseVForNode(node);
const { source } = node.parseResult;
if (leftExpressionRange && leftExpressionText && source.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
const start = leftExpressionRange.start;
const end = source.loc.start.offset + source.content.length;
let start = leftExpressionRange.start;
let end = source.loc.start.offset + source.content.length;
while (templateContent[start - 1] === ' ' || templateContent[start - 1] === '(') start--;
while (templateContent[end] === ' ' || templateContent[end] === ')') end++;
addFormatCodes(
templateContent.slice(start, end),
start,
Expand Down

0 comments on commit 42355fc

Please sign in to comment.