Skip to content

Commit

Permalink
Stage 5
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Jun 6, 2024
1 parent f847941 commit cb55e76
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions vscode/DscExt/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,31 @@ export function activate(context: vscode.ExtensionContext) {
}

const dataArray = JSON.parse(fs.readFileSync(ps_cache_file_path, 'utf-8'));
const all_props_completion = new vscode.CompletionItem(dataArray.ResourceCache[0].Type);
const key_props_completion = new vscode.CompletionItem(dataArray.ResourceCache[0].Type + " [keys only]");

let all_props_comp_text: string = ' ' + dataArray.ResourceCache[0].Type;
let key_props_comp_text: string = ' ' + dataArray.ResourceCache[0].Type;
all_props_comp_text += '\nproperties:';
key_props_comp_text += '\nproperties:';
dataArray.ResourceCache[0].DscResourceInfo.Properties.forEach(function (value: any) {
all_props_comp_text += '\n ' + value.Name + ':';
if (value.IsMandatory)
{
key_props_comp_text += '\n ' + value.Name + ':';
}
var completions:vscode.CompletionItem[] = [];
dataArray.ResourceCache.forEach(function (resouce: any) {

const all_props_completion = new vscode.CompletionItem(resouce.Type);
const key_props_completion = new vscode.CompletionItem(resouce.Type + " [keys only]");

let all_props_comp_text: string = ' ' + resouce.Type;
let key_props_comp_text: string = ' ' + resouce.Type;
all_props_comp_text += '\nproperties:';
key_props_comp_text += '\nproperties:';
resouce.DscResourceInfo.Properties.forEach(function (prop: any) {
all_props_comp_text += '\n ' + prop.Name + ': ';
if (prop.IsMandatory)
{
key_props_comp_text += '\n ' + prop.Name + ': ';
}
});
all_props_completion.insertText = new vscode.SnippetString(all_props_comp_text);
key_props_completion.insertText = new vscode.SnippetString(key_props_comp_text);

completions.push(all_props_completion);
completions.push(key_props_completion);
});
all_props_completion.insertText = new vscode.SnippetString(all_props_comp_text);
key_props_completion.insertText = new vscode.SnippetString(key_props_comp_text);

return [
all_props_completion,
key_props_completion
];
return completions;
}
},
':' // triggered whenever a ':' is being typed
Expand Down

0 comments on commit cb55e76

Please sign in to comment.