File tree 2 files changed +12
-3
lines changed
packages/language-service/lib/plugins
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 376
376
"default" : " autoKebab" ,
377
377
"description" : " Preferred attr name case."
378
378
},
379
+ "vue.autoInsert.defines" : {
380
+ "type" : " boolean" ,
381
+ "default" : true ,
382
+ "description" : " Auto add `const props = ` before `defineProps` when selecting the completion item `props`. (also `emit` and `slots`)"
383
+ },
379
384
"vue.autoInsert.dotValue" : {
380
385
"type" : " boolean" ,
381
386
"default" : false ,
Original file line number Diff line number Diff line change @@ -19,9 +19,13 @@ export function create(): LanguageServicePlugin {
19
19
return ;
20
20
}
21
21
22
- const uri = URI . parse ( document . uri ) ;
22
+ const enabled = await context . env . getConfiguration ?.< boolean > ( 'vue.autoInsert.defines' ) ?? true ;
23
+ if ( ! enabled ) {
24
+ return ;
25
+ }
26
+
23
27
const result : vscode . CompletionItem [ ] = [ ] ;
24
- const decoded = context . decodeEmbeddedDocumentUri ( uri ) ;
28
+ const decoded = context . decodeEmbeddedDocumentUri ( URI . parse ( document . uri ) ) ;
25
29
const sourceScript = decoded && context . language . scripts . get ( decoded [ 0 ] ) ;
26
30
const virtualCode = decoded && sourceScript ?. generated ?. embeddedCodes . get ( decoded [ 1 ] ) ;
27
31
if ( ! sourceScript || ! virtualCode ) {
@@ -58,7 +62,7 @@ export function create(): LanguageServicePlugin {
58
62
} | undefined ,
59
63
name : string
60
64
) {
61
- if ( ! define || define . exp . start !== define . statement ? .start ) {
65
+ if ( ! define || define . exp . start !== define . statement . start ) {
62
66
return ;
63
67
}
64
68
You can’t perform that action at this time.
0 commit comments