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

Implement remove filter command in object browser #2250

Draft
wants to merge 1 commit into
base: fix/bad_lines_from_member
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
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,13 @@
"category": "IBM i",
"icon": "$(filter)"
},
{
"command": "code-for-ibmi.objectBrowser.removeFilter",
"enablement": "code-for-ibmi:connected",
"title": "Remove Filter",
"category": "IBM i",
"icon": "$(remove)"
},
{
"command": "code-for-ibmi.objectBrowser.delete",
"enablement": "code-for-ibmi:connected",
Expand Down Expand Up @@ -2221,6 +2228,10 @@
"command": "code-for-ibmi.copyFilter",
"when": "never"
},
{
"command": "code-for-ibmi.objectBrowser.removeFilter",
"when": "never"
},
{
"command": "code-for-ibmi.objectBrowser.delete",
"when": "never"
Expand Down Expand Up @@ -2596,9 +2607,9 @@
"group": "4_filters@2"
},
{
"command": "code-for-ibmi.objectBrowser.delete",
"command": "code-for-ibmi.objectBrowser.removeFilter",
"when": "view == objectBrowser && viewItem =~ /^filter.*$/",
"group": "4_filters@3"
"group": "4_filters@4"
},
{
"command": "code-for-ibmi.moveFilterUp",
Expand Down
9 changes: 9 additions & 0 deletions src/views/objectBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,15 @@ export function initializeObjectBrowser(context: vscode.ExtensionContext) {
}
} while (newLibrary && !newLibraryOK)
}),
vscode.commands.registerCommand(`code-for-ibmi.objectBrowser.removeFilter`, async (node?: ObjectBrowserItem) => {
if (node && node instanceof ObjectBrowserFilterItem) {
const message = t('objectBrowser.delete.confirm', node.toString());
if (await vscode.window.showWarningMessage(message, { modal: true }, t(`Yes`))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'Remove Shortcut' in the IFS browser does not have a warning, would we want to match that functionality more?

await node.delete();
vscode.commands.executeCommand(`code-for-ibmi.refreshObjectBrowser`);
}
}
}),
vscode.commands.registerCommand("code-for-ibmi.objectBrowser.delete", async (node?: ObjectBrowserItem, nodes?: ObjectBrowserItem[]) => {
const candidates: ObjectBrowserItem[] = [];
if (nodes) {
Expand Down