File tree Expand file tree Collapse file tree 1 file changed +10
-22
lines changed Expand file tree Collapse file tree 1 file changed +10
-22
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ export const completionProvider: vscode.CompletionItemProvider = {
64
64
return undefined ;
65
65
}
66
66
67
- const componentPrefixes = [ "x" , "x-" ] ;
68
- const pathPrefix = "components." ;
67
+ const components = getBladeComponents ( ) . items ;
68
+
69
+ const componentPrefixes = [ "x" , "x-" ] . concat ( components . prefixes ) ;
69
70
const line = doc . lineAt ( pos . line ) . text ;
70
71
71
72
const match = componentPrefixes . find ( ( prefix ) => {
@@ -81,26 +82,13 @@ export const completionProvider: vscode.CompletionItemProvider = {
81
82
return undefined ;
82
83
}
83
84
84
- return getBladeComponents ( )
85
- . items . filter ( ( view ) => view . key . startsWith ( pathPrefix ) )
86
- . map ( ( view ) => {
87
- const parts = view . key . split ( "." ) ;
88
-
89
- if ( parts [ parts . length - 1 ] === "index" ) {
90
- parts . pop ( ) ;
91
- }
92
-
93
- while (
94
- parts . length > 1 &&
95
- parts [ parts . length - 1 ] === parts [ parts . length - 2 ]
96
- ) {
97
- parts . pop ( ) ;
98
- }
99
-
100
- return new vscode . CompletionItem (
101
- "x-" + parts . join ( "." ) . replace ( pathPrefix , "" ) ,
102
- ) ;
103
- } ) ;
85
+ return Object . keys ( components . components ) . map ( ( key ) => {
86
+ if ( key . includes ( "::" ) || ! key . includes ( ":" ) ) {
87
+ return new vscode . CompletionItem ( `x-${ key } ` ) ;
88
+ }
89
+
90
+ return new vscode . CompletionItem ( key ) ;
91
+ } ) ;
104
92
} ,
105
93
} ;
106
94
You can’t perform that action at this time.
0 commit comments