Skip to content

Commit ff4b7ea

Browse files
committed
fix(language-core): avoid interpolation indentation affecting each other
1 parent 993fcec commit ff4b7ea

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

packages/language-core/lib/generators/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const presetInfos = {
3939
const formatBrackets = {
4040
normal: ['`${', '}`;'] as [string, string],
4141
// fix https://github.com/vuejs/language-tools/issues/3572
42-
params: ['(', ') => {}'] as [string, string],
42+
params: ['(', ') => {};'] as [string, string],
4343
// fix https://github.com/vuejs/language-tools/issues/1210
4444
// fix https://github.com/vuejs/language-tools/issues/2305
4545
curly: ['0 +', '+ 0;'] as [string, string],
@@ -483,7 +483,7 @@ export function* generate(
483483
start,
484484
lines.length <= 1 ? formatBrackets.curly : [
485485
lines[0].trim() === '' ? '(' : formatBrackets.curly[0],
486-
lines[lines.length - 1].trim() === '' ? ')' : formatBrackets.curly[1],
486+
lines[lines.length - 1].trim() === '' ? ');' : formatBrackets.curly[1],
487487
],
488488
);
489489
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineFormatTest } from '../utils/format';
2+
3+
defineFormatTest({
4+
title: '#' + __filename.split('.')[0],
5+
languageId: 'vue',
6+
input: `
7+
<template>
8+
{{
9+
foo
10+
}}
11+
{{
12+
bar
13+
}}
14+
</template>
15+
`.trim(),
16+
output: `
17+
<template>
18+
{{
19+
foo
20+
}}
21+
{{
22+
bar
23+
}}
24+
</template>
25+
`.trim(),
26+
});

0 commit comments

Comments
 (0)