@@ -33,27 +33,31 @@ export function activate(context: vscode.ExtensionContext) {
33
33
}
34
34
35
35
const dataArray = JSON . parse ( fs . readFileSync ( ps_cache_file_path , 'utf-8' ) ) ;
36
- const all_props_completion = new vscode . CompletionItem ( dataArray . ResourceCache [ 0 ] . Type ) ;
37
- const key_props_completion = new vscode . CompletionItem ( dataArray . ResourceCache [ 0 ] . Type + " [keys only]" ) ;
38
-
39
- let all_props_comp_text : string = ' ' + dataArray . ResourceCache [ 0 ] . Type ;
40
- let key_props_comp_text : string = ' ' + dataArray . ResourceCache [ 0 ] . Type ;
41
- all_props_comp_text += '\nproperties:' ;
42
- key_props_comp_text += '\nproperties:' ;
43
- dataArray . ResourceCache [ 0 ] . DscResourceInfo . Properties . forEach ( function ( value : any ) {
44
- all_props_comp_text += '\n ' + value . Name + ':' ;
45
- if ( value . IsMandatory )
46
- {
47
- key_props_comp_text += '\n ' + value . Name + ':' ;
48
- }
36
+ var completions :vscode . CompletionItem [ ] = [ ] ;
37
+ dataArray . ResourceCache . forEach ( function ( resouce : any ) {
38
+
39
+ const all_props_completion = new vscode . CompletionItem ( resouce . Type ) ;
40
+ const key_props_completion = new vscode . CompletionItem ( resouce . Type + " [keys only]" ) ;
41
+
42
+ let all_props_comp_text : string = ' ' + resouce . Type ;
43
+ let key_props_comp_text : string = ' ' + resouce . Type ;
44
+ all_props_comp_text += '\nproperties:' ;
45
+ key_props_comp_text += '\nproperties:' ;
46
+ resouce . DscResourceInfo . Properties . forEach ( function ( prop : any ) {
47
+ all_props_comp_text += '\n ' + prop . Name + ': ' ;
48
+ if ( prop . IsMandatory )
49
+ {
50
+ key_props_comp_text += '\n ' + prop . Name + ': ' ;
51
+ }
52
+ } ) ;
53
+ all_props_completion . insertText = new vscode . SnippetString ( all_props_comp_text ) ;
54
+ key_props_completion . insertText = new vscode . SnippetString ( key_props_comp_text ) ;
55
+
56
+ completions . push ( all_props_completion ) ;
57
+ completions . push ( key_props_completion ) ;
49
58
} ) ;
50
- all_props_completion . insertText = new vscode . SnippetString ( all_props_comp_text ) ;
51
- key_props_completion . insertText = new vscode . SnippetString ( key_props_comp_text ) ;
52
59
53
- return [
54
- all_props_completion ,
55
- key_props_completion
56
- ] ;
60
+ return completions ;
57
61
}
58
62
} ,
59
63
':' // triggered whenever a ':' is being typed
0 commit comments