From b6f350b8f98dbe8e021d6b47889c5fb6ae767cd9 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Thu, 14 Nov 2024 16:53:17 -0600 Subject: [PATCH 1/4] Fixed bug with missing labels breaking search / filter (49) --- src/util/treeViewUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/treeViewUtils.ts b/src/util/treeViewUtils.ts index a5aa6da3..7a3376cf 100644 --- a/src/util/treeViewUtils.ts +++ b/src/util/treeViewUtils.ts @@ -80,7 +80,7 @@ export function getPanelVariableTreeItem([url, variable]: [ const iconPath = getVariableIconPath(variable.type); return { - description: variable.title, + label: variable.title, iconPath, command: { title: 'Open Panel', From 63eb9781862bb240c6f31c2a86411f61c661a4c4 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Fri, 15 Nov 2024 08:08:22 -0600 Subject: [PATCH 2/4] Updated snapshots (49) --- .../__snapshots__/treeViewUtils.spec.ts.snap | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/util/__snapshots__/treeViewUtils.spec.ts.snap b/src/util/__snapshots__/treeViewUtils.spec.ts.snap index eeae18d6..da328bd2 100644 --- a/src/util/__snapshots__/treeViewUtils.spec.ts.snap +++ b/src/util/__snapshots__/treeViewUtils.spec.ts.snap @@ -63,11 +63,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "graph", }, + "label": "some title", } `; @@ -86,11 +86,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "dh-table", }, + "label": "some title", } `; @@ -109,11 +109,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "preview", }, + "label": "some title", } `; @@ -132,11 +132,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "dh-table", }, + "label": "some title", } `; @@ -155,11 +155,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "dh-table", }, + "label": "some title", } `; @@ -178,11 +178,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "dh-table", }, + "label": "some title", } `; @@ -201,11 +201,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "dh-table", }, + "label": "some title", } `; @@ -224,11 +224,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "preview", }, + "label": "some title", } `; @@ -247,11 +247,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "graph", }, + "label": "some title", } `; @@ -270,11 +270,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "preview", }, + "label": "some title", } `; @@ -293,11 +293,11 @@ exports[`getPanelVariableTreeItem > should return panel variable tree item: type "command": "vscode-deephaven.openVariablePanels", "title": "Open Panel", }, - "description": "some title", "iconPath": { "color": undefined, "id": "dh-pandas", }, + "label": "some title", } `; From 00b40d744a40486c63a0bd8266610e00bad3dc9c Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Fri, 15 Nov 2024 09:27:19 -0600 Subject: [PATCH 3/4] Added search action to connection + panels tree panels (49) --- package.json | 28 ++++++++++++++++++ src/common/commands.ts | 2 ++ src/common/constants.ts | 2 ++ src/controllers/ControllerBase.ts | 8 +++-- src/controllers/ExtensionController.ts | 41 ++++++++++++++++++++++++-- 5 files changed, 75 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f27f8cec..df0b7336 100644 --- a/package.json +++ b/package.json @@ -226,6 +226,16 @@ "command": "vscode-deephaven.createDHEAuthenticatedClient", "title": "Create DHE Authenticated Client" }, + { + "command": "vscode-deephaven.searchConnections", + "title": "Search Connections", + "icon": "$(search)" + }, + { + "command": "vscode-deephaven.searchPanels", + "title": "Search Panels", + "icon": "$(search)" + }, { "command": "vscode-deephaven.startServer", "title": "Deephaven: Start Server", @@ -703,6 +713,14 @@ "command": "vscode-deephaven.refreshVariablePanels", "when": "false" }, + { + "command": "vscode-deephaven.searchConnections", + "when": "false" + }, + { + "command": "vscode-deephaven.searchPanels", + "when": "false" + }, { "command": "vscode-deephaven.createCoreAuthenticatedClient", "when": "false" @@ -746,6 +764,16 @@ "command": "vscode-deephaven.refreshServerConnectionTree", "group": "navigation", "when": "view == vscode-deephaven.serverConnectionTree" + }, + { + "command": "vscode-deephaven.searchConnections", + "group": "navigation", + "when": "view == vscode-deephaven.serverConnectionTree" + }, + { + "command": "vscode-deephaven.searchPanels", + "group": "navigation", + "when": "view == vscode-deephaven.serverConnectionPanelTree" } ], "view/item/context": [ diff --git a/src/common/commands.ts b/src/common/commands.ts index 6a2fac06..4fa13eaf 100644 --- a/src/common/commands.ts +++ b/src/common/commands.ts @@ -31,6 +31,8 @@ export const REFRESH_SERVER_CONNECTION_TREE_CMD = cmd( export const REFRESH_VARIABLE_PANELS_CMD = cmd('refreshVariablePanels'); export const RUN_CODE_COMMAND = cmd('runCode'); export const RUN_SELECTION_COMMAND = cmd('runSelection'); +export const SEARCH_CONNECTIONS_CMD = cmd('searchConnections'); +export const SEARCH_PANELS_CMD = cmd('searchPanels'); export const SELECT_CONNECTION_COMMAND = cmd('selectConnection'); export const START_SERVER_CMD = cmd('startServer'); export const STOP_SERVER_CMD = cmd('stopServer'); diff --git a/src/common/constants.ts b/src/common/constants.ts index 7f670b6c..e0d6ca40 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -55,6 +55,8 @@ export const VIEW_ID = { serverConnectionPanelTree: `${EXTENSION_ID}.serverConnectionPanelTree`, } as const; +export type ViewID = (typeof VIEW_ID)[keyof typeof VIEW_ID]; + export const ICON_ID = { blank: 'blank', connected: 'vm-connect', diff --git a/src/controllers/ControllerBase.ts b/src/controllers/ControllerBase.ts index 200b4b1a..2638eaa4 100644 --- a/src/controllers/ControllerBase.ts +++ b/src/controllers/ControllerBase.ts @@ -10,10 +10,12 @@ export abstract class ControllerBase implements Disposable { /** * Register a command and add it's subscription to the disposables list. */ - registerCommand = ( - ...args: Parameters + registerCommand = ( + command: string, + callback: (this: TThis, ...args: any[]) => any, + thisArg?: TThis ): void => { - const cmd = vscode.commands.registerCommand(...args); + const cmd = vscode.commands.registerCommand(command, callback, thisArg); this.disposables.push(cmd); }; diff --git a/src/controllers/ExtensionController.ts b/src/controllers/ExtensionController.ts index 9bc1e5d8..5e68e926 100644 --- a/src/controllers/ExtensionController.ts +++ b/src/controllers/ExtensionController.ts @@ -14,10 +14,13 @@ import { REFRESH_SERVER_TREE_CMD, RUN_CODE_COMMAND, RUN_SELECTION_COMMAND, + SEARCH_CONNECTIONS_CMD, + SEARCH_PANELS_CMD, SELECT_CONNECTION_COMMAND, START_SERVER_CMD, STOP_SERVER_CMD, VIEW_ID, + type ViewID, } from '../common'; import { assertDefined, @@ -474,6 +477,20 @@ export class ExtensionController implements Disposable { this.onRefreshServerStatus ); + /** Search connections */ + this.registerCommand( + SEARCH_CONNECTIONS_CMD, + this.onSearchTree, + VIEW_ID.serverConnectionTree + ); + + /** Search variable panels */ + this.registerCommand( + SEARCH_PANELS_CMD, + this.onSearchTree, + VIEW_ID.serverConnectionPanelTree + ); + /** Start a server */ this.registerCommand(START_SERVER_CMD, this.onStartServer); @@ -747,6 +764,22 @@ export class ExtensionController implements Disposable { this.onRunCode(uri, arg, true); }; + /** + * Open search connections. + */ + onSearchConnections = async (): Promise => { + vscode.commands.executeCommand(`${VIEW_ID.serverConnectionTree}.focus`); + vscode.commands.executeCommand('list.find'); + }; + + /** + * Open search input for tree panel. + */ + onSearchTree = async function (this: ViewID): Promise { + vscode.commands.executeCommand(`${this}.focus`); + vscode.commands.executeCommand('list.find'); + }; + /** * Start a server. */ @@ -765,10 +798,12 @@ export class ExtensionController implements Disposable { /** * Register a command and add it's subscription to the context. */ - registerCommand = ( - ...args: Parameters + registerCommand = ( + command: string, + callback: (this: TThis, ...args: any[]) => any, + thisArg?: TThis ): void => { - const cmd = vscode.commands.registerCommand(...args); + const cmd = vscode.commands.registerCommand(command, callback, thisArg); this._context.subscriptions.push(cmd); }; } From bb35ca154a4112dced769781b66d32efb7d57c66 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Fri, 15 Nov 2024 09:45:45 -0600 Subject: [PATCH 4/4] Removed unused handler (49) --- src/controllers/ExtensionController.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/controllers/ExtensionController.ts b/src/controllers/ExtensionController.ts index 5e68e926..adf52de0 100644 --- a/src/controllers/ExtensionController.ts +++ b/src/controllers/ExtensionController.ts @@ -764,14 +764,6 @@ export class ExtensionController implements Disposable { this.onRunCode(uri, arg, true); }; - /** - * Open search connections. - */ - onSearchConnections = async (): Promise => { - vscode.commands.executeCommand(`${VIEW_ID.serverConnectionTree}.focus`); - vscode.commands.executeCommand('list.find'); - }; - /** * Open search input for tree panel. */