File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
packages/language-service/lib/plugins Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 376376 "default" : " autoKebab" ,
377377 "description" : " Preferred attr name case."
378378 },
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+ },
379384 "vue.autoInsert.dotValue" : {
380385 "type" : " boolean" ,
381386 "default" : false ,
Original file line number Diff line number Diff line change @@ -19,9 +19,13 @@ export function create(): LanguageServicePlugin {
1919 return ;
2020 }
2121
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+
2327 const result : vscode . CompletionItem [ ] = [ ] ;
24- const decoded = context . decodeEmbeddedDocumentUri ( uri ) ;
28+ const decoded = context . decodeEmbeddedDocumentUri ( URI . parse ( document . uri ) ) ;
2529 const sourceScript = decoded && context . language . scripts . get ( decoded [ 0 ] ) ;
2630 const virtualCode = decoded && sourceScript ?. generated ?. embeddedCodes . get ( decoded [ 1 ] ) ;
2731 if ( ! sourceScript || ! virtualCode ) {
@@ -58,7 +62,7 @@ export function create(): LanguageServicePlugin {
5862 } | undefined ,
5963 name : string
6064 ) {
61- if ( ! define || define . exp . start !== define . statement ? .start ) {
65+ if ( ! define || define . exp . start !== define . statement . start ) {
6266 return ;
6367 }
6468
You can’t perform that action at this time.
0 commit comments