Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add list profiles from given rule. #38

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
{
"command": "content-navigator.copyFullPrefixedRuleId",
"title": "Copy Full Prefixed Rule ID"
},
{
"command": "content-navigator.listProfilesRuleIsSelected",
"title": "List profiles"
}
],
"menus": {
Expand Down Expand Up @@ -105,6 +109,9 @@
{
"command": "content-navigator.copyRuleId"
},
{
"command": "content-navigator.listProfilesRuleIsSelected"
},
{
"command": "content-navigator.copyFullPrefixedRuleId"
}
Expand Down
25 changes: 25 additions & 0 deletions src/content-navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ async function openFile(rule_id : string, location : string) : Promise<boolean>
return false
}

export async function listProfilesRuleIsSelected() : Promise<boolean> {
let rule_id = getRuleId();

if(rule_id != "")
{
let profiles = await vscode.workspace.findFiles('**/*.profile');
if(profiles.length > 0)
{
profiles.forEach(async element => {
let text = await vscode.workspace.openTextDocument(element);
let i = 0;
if(text.getText().indexOf(rule_id)){
vscode.window.showInformationMessage(element.toString());
}
});
}
}
return true
}

export async function openContent(location: string) {
// Get the active text editor

Expand Down Expand Up @@ -191,6 +211,10 @@ export function activate(context: vscode.ExtensionContext) {
return getRuleId();
});

let list_profiles_command = vscode.commands.registerCommand('content-navigator.listProfilesRuleIsSelected', () => {
return listProfilesRuleIsSelected();
});

context.subscriptions.push(open_rule_command);
context.subscriptions.push(open_oval_command);
context.subscriptions.push(open_bash_command);
Expand All @@ -201,6 +225,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(copy_rule_id_command);
context.subscriptions.push(copy_full_prefixed_rule_id_command);
context.subscriptions.push(get_rule_id);
context.subscriptions.push(list_profiles_command);

let completionList: vscode.CompletionItem[] = [];

Expand Down