@@ -48,7 +48,7 @@ function* generateScript(
48
48
yield * generateScriptSetupImports ( options . sfc . scriptSetup , options . scriptSetupRanges ) ;
49
49
}
50
50
if ( options . sfc . script && options . scriptRanges ) {
51
- const exportDefault = options . scriptRanges . componentOptions ?? options . scriptRanges . exportDefault ;
51
+ const { exportDefault, componentOptions } = options . scriptRanges ;
52
52
if ( options . sfc . scriptSetup && options . scriptSetupRanges ) {
53
53
if ( exportDefault ) {
54
54
yield generateSfcBlockSection ( options . sfc . script , 0 , exportDefault . start , codeFeatures . all ) ;
@@ -60,16 +60,18 @@ function* generateScript(
60
60
}
61
61
}
62
62
else if ( exportDefault ) {
63
+ const { expression } = componentOptions ?? exportDefault ;
64
+
63
65
let wrapLeft : string | undefined ;
64
66
let wrapRight : string | undefined ;
65
67
if (
66
- options . sfc . script . content [ exportDefault . expression . start ] === '{'
68
+ options . sfc . script . content [ expression . start ] === '{'
67
69
&& options . vueCompilerOptions . optionsWrapper . length
68
70
) {
69
71
[ wrapLeft , wrapRight ] = options . vueCompilerOptions . optionsWrapper ;
70
72
ctx . inlayHints . push ( {
71
73
blockName : options . sfc . script . name ,
72
- offset : exportDefault . expression . start ,
74
+ offset : expression . start ,
73
75
setting : 'vue.inlayHints.optionsWrapper' ,
74
76
label : wrapLeft || '[Missing optionsWrapper[0]]' ,
75
77
tooltip : [
@@ -78,7 +80,7 @@ function* generateScript(
78
80
] . join ( '\n\n' ) ,
79
81
} , {
80
82
blockName : options . sfc . script . name ,
81
- offset : exportDefault . expression . end ,
83
+ offset : expression . end ,
82
84
setting : 'vue.inlayHints.optionsWrapper' ,
83
85
label : wrapRight || '[Missing optionsWrapper[1]]' ,
84
86
} ) ;
@@ -89,12 +91,7 @@ function* generateScript(
89
91
if ( wrapLeft ) {
90
92
yield wrapLeft ;
91
93
}
92
- yield generateSfcBlockSection (
93
- options . sfc . script ,
94
- exportDefault . expression . start ,
95
- exportDefault . expression . end ,
96
- codeFeatures . all ,
97
- ) ;
94
+ yield generateSfcBlockSection ( options . sfc . script , expression . start , expression . end , codeFeatures . all ) ;
98
95
if ( wrapRight ) {
99
96
yield wrapRight ;
100
97
}
@@ -149,7 +146,7 @@ export function* generateConstExport(
149
146
if ( options . sfc . script ) {
150
147
yield * generatePartiallyEnding (
151
148
options . sfc . script . name ,
152
- options . scriptRanges ?. componentOptions ?. start ?? options . sfc . script . content . length ,
149
+ options . scriptRanges ?. exportDefault ?. start ?? options . sfc . script . content . length ,
153
150
'#3632/script.vue' ,
154
151
) ;
155
152
}
0 commit comments