From 10928d0da52eae42f72af33812226bf022e1029e Mon Sep 17 00:00:00 2001 From: corbob Date: Tue, 8 Jan 2019 06:12:21 -0800 Subject: [PATCH 1/4] Add a filter... --- package.json | 5 +++++ src/features/GetCommands.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 341b4623a3..0efb49607d 100644 --- a/package.json +++ b/package.json @@ -482,6 +482,11 @@ "default": true, "description": "Specifies the visibility of the Command Explorer in the PowerShell Side Bar." }, + "powershell.sideBar.CommandExplorerExcludeFilter": { + "type":"string", + "default":"", + "description": "" + }, "powershell.powerShellExePath": { "type": "string", "default": "", diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index 0a269f3d3a..bf6616ed54 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -64,7 +64,13 @@ export class GetCommandsFeature implements IFeature { return; } this.languageClient.sendRequest(GetCommandRequestType, "").then((result) => { - this.commandsExplorerProvider.powerShellCommands = result.map(toCommand); + const SidebarConfig = vscode.workspace.getConfiguration("powershell.sideBar"); + let output: Array; + if (SidebarConfig.CommandExplorerExcludeFilter !== "") { + // tslint:disable-next-line:max-line-length + output = result.filter((command) => command.moduleName.includes(SidebarConfig.CommandExplorerExcludeFilter)); // .where({$_.moduleName -ne SidebarConfig.CommandExplorerExcludeFilter}) + } + this.commandsExplorerProvider.powerShellCommands = output.map(toCommand); this.commandsExplorerProvider.refresh(); }); } From 497c1bfd2d2d15d8489580fee0ada9961c67a0d2 Mon Sep 17 00:00:00 2001 From: corbob Date: Mon, 7 Jan 2019 20:56:18 -0800 Subject: [PATCH 2/4] Work with comma separated exclude filter --- src/features/GetCommands.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index bf6616ed54..3f033f36bc 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -65,12 +65,15 @@ export class GetCommandsFeature implements IFeature { } this.languageClient.sendRequest(GetCommandRequestType, "").then((result) => { const SidebarConfig = vscode.workspace.getConfiguration("powershell.sideBar"); - let output: Array; - if (SidebarConfig.CommandExplorerExcludeFilter !== "") { - // tslint:disable-next-line:max-line-length - output = result.filter((command) => command.moduleName.includes(SidebarConfig.CommandExplorerExcludeFilter)); // .where({$_.moduleName -ne SidebarConfig.CommandExplorerExcludeFilter}) + const excludeFilter: string = SidebarConfig.CommandExplorerExcludeFilter; + if (excludeFilter !== "") { + const filters = excludeFilter.split(","); + filters.forEach((filter) => { + result = result.filter((command) => + !command.moduleName.includes(filter)); + }); } - this.commandsExplorerProvider.powerShellCommands = output.map(toCommand); + this.commandsExplorerProvider.powerShellCommands = result.map(toCommand); this.commandsExplorerProvider.refresh(); }); } From 710e57dd96ce50c05c6af646712ceccf7f19bf57 Mon Sep 17 00:00:00 2001 From: CorBob Date: Sun, 13 Jan 2019 16:00:24 -0800 Subject: [PATCH 3/4] Adjust filter. Remove case sensetivity. --- src/features/GetCommands.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index 3f033f36bc..0688ed974f 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -65,14 +65,8 @@ export class GetCommandsFeature implements IFeature { } this.languageClient.sendRequest(GetCommandRequestType, "").then((result) => { const SidebarConfig = vscode.workspace.getConfiguration("powershell.sideBar"); - const excludeFilter: string = SidebarConfig.CommandExplorerExcludeFilter; - if (excludeFilter !== "") { - const filters = excludeFilter.split(","); - filters.forEach((filter) => { - result = result.filter((command) => - !command.moduleName.includes(filter)); - }); - } + const excludeFilter = (SidebarConfig.CommandExplorerExcludeFilter as string).toLowerCase().split(","); + result = result.filter((command) => (excludeFilter.indexOf(command.moduleName.toLowerCase()) === -1)); this.commandsExplorerProvider.powerShellCommands = result.map(toCommand); this.commandsExplorerProvider.refresh(); }); From 06d1e29b88c2a3399d3f92b8a374d5fbd0c93c9f Mon Sep 17 00:00:00 2001 From: CorBob Date: Wed, 16 Jan 2019 20:20:17 -0800 Subject: [PATCH 4/4] Change Exclude Fitler to array. --- package.json | 4 ++-- src/features/GetCommands.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0efb49607d..9a44a1079a 100644 --- a/package.json +++ b/package.json @@ -483,9 +483,9 @@ "description": "Specifies the visibility of the Command Explorer in the PowerShell Side Bar." }, "powershell.sideBar.CommandExplorerExcludeFilter": { - "type":"string", + "type":"array", "default":"", - "description": "" + "description": "Specify array of Modules to exclude from Command Explorer listing." }, "powershell.powerShellExePath": { "type": "string", diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index 0688ed974f..b109c74e73 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -65,7 +65,7 @@ export class GetCommandsFeature implements IFeature { } this.languageClient.sendRequest(GetCommandRequestType, "").then((result) => { const SidebarConfig = vscode.workspace.getConfiguration("powershell.sideBar"); - const excludeFilter = (SidebarConfig.CommandExplorerExcludeFilter as string).toLowerCase().split(","); + const excludeFilter = (SidebarConfig.CommandExplorerExcludeFilter).map((filter) => filter.toLowerCase()); result = result.filter((command) => (excludeFilter.indexOf(command.moduleName.toLowerCase()) === -1)); this.commandsExplorerProvider.powerShellCommands = result.map(toCommand); this.commandsExplorerProvider.refresh();