diff --git a/src/controllers/ExtensionController.ts b/src/controllers/ExtensionController.ts index 9641629e..509d9024 100644 --- a/src/controllers/ExtensionController.ts +++ b/src/controllers/ExtensionController.ts @@ -243,11 +243,6 @@ export class ExtensionController implements Disposable { this._outputChannel, this._toaster ); - this._dhcServiceFactory.onCreated( - this.onDhServiceCreated, - undefined, - this._context.subscriptions - ); this._serverManager = new ServerManager( this._config, @@ -458,19 +453,6 @@ export class ExtensionController implements Disposable { this._serverManager?.setEditorConnection(editor, dhService); }; - /** - * Handle when a new Deephaven service is created. - * @param dhService The Deephaven service that was created. - * @returns void - */ - onDhServiceCreated = (dhService: IDhService): void => { - dhService.onRequestVariablePanels( - variables => this.onOpenVariablePanels(dhService.serverUrl, variables), - undefined, - this._context.subscriptions - ); - }; - /** * Disconnect editor from active connections. * @param uri diff --git a/src/services/DhService.ts b/src/services/DhService.ts index 4c52908b..9e90c6b3 100644 --- a/src/services/DhService.ts +++ b/src/services/DhService.ts @@ -16,7 +16,7 @@ import { NoConsoleTypesError, parseServerError, } from '../util'; -import { VARIABLE_UNICODE_ICONS } from '../common'; +import { OPEN_VARIABLE_PANELS_CMD, VARIABLE_UNICODE_ICONS } from '../common'; const logger = new Logger('DhService'); @@ -38,11 +38,6 @@ export abstract class DhService private readonly _onDidDisconnect = new vscode.EventEmitter(); readonly onDidDisconnect = this._onDidDisconnect.event; - public readonly _onRequestVariablePanels = new vscode.EventEmitter< - VariableDefintion[] - >(); - readonly onRequestVariablePanels = this._onRequestVariablePanels.event; - public readonly serverUrl: URL; protected readonly subscriptions: (() => void)[] = []; @@ -88,7 +83,6 @@ export abstract class DhService public async dispose(): Promise { this.clearCaches(); this._onDidDisconnect.dispose(); - this._onRequestVariablePanels.dispose(); } protected getToastErrorMessage( @@ -301,8 +295,12 @@ export abstract class DhService this.outputChannel.appendLine(`${icon} ${title}`); }); - this._onRequestVariablePanels.fire( - changed.filter(v => !v.title.startsWith('_')) + const showVariables = changed.filter(v => !v.title.startsWith('_')); + + vscode.commands.executeCommand( + OPEN_VARIABLE_PANELS_CMD, + this.serverUrl, + showVariables ); } diff --git a/src/services/DhcServiceFactory.ts b/src/services/DhcServiceFactory.ts index 30ad581d..b3f30ade 100644 --- a/src/services/DhcServiceFactory.ts +++ b/src/services/DhcServiceFactory.ts @@ -12,13 +12,6 @@ export class DhcServiceFactory implements IDhServiceFactory { private toaster: IToastService ) {} - dispose = async (): Promise => { - this._onCreated.dispose(); - }; - - private _onCreated = new vscode.EventEmitter(); - readonly onCreated = this._onCreated.event; - create = (serverUrl: URL, psk?: string): DhcService => { const dhService = new DhcService( serverUrl, @@ -31,8 +24,6 @@ export class DhcServiceFactory implements IDhServiceFactory { dhService.setPsk(psk); } - this._onCreated.fire(dhService); - return dhService; }; } diff --git a/src/types/serviceTypes.d.ts b/src/types/serviceTypes.d.ts index 25aafc5d..aeb273a0 100644 --- a/src/types/serviceTypes.d.ts +++ b/src/types/serviceTypes.d.ts @@ -29,7 +29,6 @@ export interface IDhService readonly isInitialized: boolean; readonly isConnected: boolean; readonly onDidDisconnect: vscode.Event; - readonly onRequestVariablePanels: vscode.Event; initDh: () => Promise; @@ -61,11 +60,10 @@ export interface IFactory { /** * Factory for creating IDhService instances. */ -export interface IDhServiceFactory - extends IFactory, - Disposable { - readonly onCreated: vscode.Event; -} +export type IDhServiceFactory = IFactory< + IDhService, + [serverUrl: URL, psk?: string] +>; export interface IPanelService extends Disposable { getPanelOrThrow: (url: URL, variableId: VariableID) => vscode.WebviewPanel;