@@ -15,6 +15,7 @@ import { generateInterpolation } from './interpolation';
15
15
import { generatePropertyAccess } from './propertyAccess' ;
16
16
import { generateTemplateChild } from './templateChild' ;
17
17
import { generateObjectProperty } from './objectProperty' ;
18
+ import { createVBindShorthandInlayHintInfo } from '../inlayHints' ;
18
19
import { getNodeText } from '../../parsers/scriptSetupRanges' ;
19
20
20
21
const colonReg = / : / g;
@@ -48,16 +49,24 @@ export function* generateComponent(
48
49
49
50
let props = node . props ;
50
51
let dynamicTagInfo : {
51
- exp : string ;
52
+ tag : string ;
52
53
offsets : [ number , number | undefined ] ;
53
- astHolder : any ;
54
+ astHolder : CompilerDOM . SourceLocation ;
54
55
} | undefined ;
55
56
56
57
if ( isComponentTag ) {
57
58
for ( const prop of node . props ) {
58
- if ( prop . type === CompilerDOM . NodeTypes . DIRECTIVE && prop . name === 'bind' && prop . arg ?. loc . source === 'is' && prop . exp ) {
59
+ if (
60
+ prop . type === CompilerDOM . NodeTypes . DIRECTIVE
61
+ && prop . name === 'bind'
62
+ && prop . arg ?. loc . source === 'is'
63
+ && prop . exp ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
64
+ ) {
65
+ if ( prop . arg . loc . end . offset === prop . exp . loc . end . offset ) {
66
+ ctx . inlayHints . push ( createVBindShorthandInlayHintInfo ( prop . exp . loc , 'is' ) ) ;
67
+ }
59
68
dynamicTagInfo = {
60
- exp : prop . exp . loc . source ,
69
+ tag : prop . exp . content ,
61
70
offsets : [ prop . exp . loc . start . offset , undefined ] ,
62
71
astHolder : prop . exp . loc ,
63
72
} ;
@@ -69,9 +78,9 @@ export function* generateComponent(
69
78
else if ( node . tag . includes ( '.' ) ) {
70
79
// namespace tag
71
80
dynamicTagInfo = {
72
- exp : node . tag ,
73
- astHolder : node . loc ,
81
+ tag : node . tag ,
74
82
offsets : [ startTagOffset , endTagOffset ] ,
83
+ astHolder : node . loc ,
75
84
} ;
76
85
}
77
86
@@ -110,7 +119,7 @@ export function* generateComponent(
110
119
yield * generateInterpolation (
111
120
options ,
112
121
ctx ,
113
- dynamicTagInfo . exp ,
122
+ dynamicTagInfo . tag ,
114
123
dynamicTagInfo . astHolder ,
115
124
dynamicTagInfo . offsets [ 0 ] ,
116
125
ctx . codeFeatures . all ,
@@ -122,7 +131,7 @@ export function* generateComponent(
122
131
yield * generateInterpolation (
123
132
options ,
124
133
ctx ,
125
- dynamicTagInfo . exp ,
134
+ dynamicTagInfo . tag ,
126
135
dynamicTagInfo . astHolder ,
127
136
dynamicTagInfo . offsets [ 1 ] ,
128
137
{
0 commit comments