File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,11 @@ const plugin: VueLanguagePlugin = ({ modules }) => {
38
38
get ( target , prop ) {
39
39
if ( prop === 'offset' ) {
40
40
const htmlOffset = target . offset ;
41
+ const nums : number [ ] = [ ] ;
41
42
for ( const mapped of map . getSourceOffsets ( htmlOffset ) ) {
42
- return mapped [ 0 ] ;
43
+ nums . push ( mapped [ 0 ] ) ;
43
44
}
44
- return - 1 ;
45
+ return Math . max ( - 1 , ... nums ) ;
45
46
}
46
47
const value = target [ prop ] ;
47
48
if ( typeof value === 'object' ) {
Original file line number Diff line number Diff line change @@ -129,13 +129,17 @@ export function getComponentSpans(
129
129
}
130
130
if ( node . type === 1 satisfies vue . CompilerDOM . NodeTypes . ELEMENT ) {
131
131
if ( components . has ( node . tag ) ) {
132
+ let start = node . loc . start . offset ;
133
+ if ( template . lang === 'html' ) {
134
+ start += '<' . length ;
135
+ }
132
136
result . push ( {
133
- start : node . loc . start . offset + node . loc . source . indexOf ( node . tag ) ,
137
+ start,
134
138
length : node . tag . length ,
135
139
} ) ;
136
140
if ( template . lang === 'html' && ! node . isSelfClosing ) {
137
141
result . push ( {
138
- start : node . loc . start . offset + node . loc . source . lastIndexOf ( node . tag ) ,
142
+ start : start + node . loc . source . lastIndexOf ( node . tag ) ,
139
143
length : node . tag . length ,
140
144
} ) ;
141
145
}
You can’t perform that action at this time.
0 commit comments