@@ -94,7 +94,7 @@ const plugin: VueLanguagePlugin = ctx => {
94
94
}
95
95
if ( prop . arg ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION && ! prop . arg . isStatic ) {
96
96
addFormatCodes (
97
- prop . arg . content ,
97
+ prop . arg . loc . source ,
98
98
prop . arg . loc . start . offset ,
99
99
formatBrackets . normal
100
100
) ;
@@ -107,7 +107,7 @@ const plugin: VueLanguagePlugin = ctx => {
107
107
const ast = createTsAst ( ctx . modules . typescript , prop . exp , prop . exp . content ) ;
108
108
if ( isCompoundExpression ( ctx . modules . typescript , ast ) ) {
109
109
addFormatCodes (
110
- prop . exp . content ,
110
+ prop . exp . loc . source ,
111
111
prop . exp . loc . start . offset ,
112
112
formatBrackets . event
113
113
) ;
@@ -118,14 +118,14 @@ const plugin: VueLanguagePlugin = ctx => {
118
118
const lastLineEmpty = lines [ lines . length - 1 ] . trim ( ) === '' ;
119
119
if ( lines . length <= 1 || ( ! firstLineEmpty && ! lastLineEmpty ) ) {
120
120
addFormatCodes (
121
- prop . exp . content ,
121
+ prop . exp . loc . source ,
122
122
prop . exp . loc . start . offset ,
123
123
formatBrackets . normal
124
124
) ;
125
125
}
126
126
else {
127
127
addFormatCodes (
128
- prop . exp . content ,
128
+ prop . exp . loc . source ,
129
129
prop . exp . loc . start . offset ,
130
130
[ '(' , ');' ]
131
131
) ;
@@ -134,14 +134,22 @@ const plugin: VueLanguagePlugin = ctx => {
134
134
}
135
135
else if ( prop . name === 'slot' ) {
136
136
addFormatCodes (
137
- prop . exp . content ,
137
+ prop . exp . loc . source ,
138
138
prop . exp . loc . start . offset ,
139
139
formatBrackets . params
140
140
) ;
141
141
}
142
+ else if ( prop . rawName === 'v-for' ) {
143
+ // #2586
144
+ addFormatCodes (
145
+ prop . exp . loc . source ,
146
+ prop . exp . loc . start . offset ,
147
+ formatBrackets . for
148
+ ) ;
149
+ }
142
150
else {
143
151
addFormatCodes (
144
- prop . exp . content ,
152
+ prop . exp . loc . source ,
145
153
prop . exp . loc . start . offset ,
146
154
formatBrackets . normal
147
155
) ;
@@ -157,7 +165,7 @@ const plugin: VueLanguagePlugin = ctx => {
157
165
const branch = node . branches [ i ] ;
158
166
if ( branch . condition ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION ) {
159
167
addFormatCodes (
160
- branch . condition . content ,
168
+ branch . condition . loc . source ,
161
169
branch . condition . loc . start . offset ,
162
170
formatBrackets . if
163
171
) ;
0 commit comments