File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
packages/language-core/lib/codegen/template Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -206,25 +206,16 @@ function getVIfNode(node: CompilerDOM.ElementNode) {
206206}
207207
208208export function parseInterpolationNode ( node : CompilerDOM . InterpolationNode , template : string ) {
209- let content = node . content . loc . source ;
210209 let start = node . content . loc . start . offset ;
211- let leftCharacter : string ;
212- let rightCharacter : string ;
210+ let end = node . content . loc . end . offset ;
213211
214212 // fix https://github.com/vuejs/language-tools/issues/1787
215- while ( ( leftCharacter = template . slice ( start - 1 , start ) ) . trim ( ) === '' && leftCharacter . length ) {
213+ while ( template [ start - 1 ] ? .trim ( ) === '' ) {
216214 start -- ;
217- content = leftCharacter + content ;
218215 }
219- while (
220- ( rightCharacter = template . slice ( start + content . length , start + content . length + 1 ) ) . trim ( ) === ''
221- && rightCharacter . length
222- ) {
223- content = content + rightCharacter ;
216+ while ( template [ end ] ?. trim ( ) === '' ) {
217+ end ++ ;
224218 }
225219
226- return [
227- content ,
228- start ,
229- ] as const ;
220+ return [ template . slice ( start , end ) , start ] as const ;
230221}
You can’t perform that action at this time.
0 commit comments