From 0462a93f11ecd4dfc37acdd36d220e1cbd12631a Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Mon, 20 May 2019 15:35:58 -0400 Subject: [PATCH] Expose actions registry (#701) --- packages/ide-api/api.d.ts | 6 ++++++ packages/vscode/src/client.ts | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/ide-api/api.d.ts b/packages/ide-api/api.d.ts index c395ac28..e0049fd6 100644 --- a/packages/ide-api/api.d.ts +++ b/packages/ide-api/api.d.ts @@ -1,6 +1,9 @@ // tslint:disable no-any import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal"; +import { IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; +import { Action } from 'vs/base/common/actions'; +import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; export interface EvalHelper { } interface ActiveEvalEmitter { @@ -146,7 +149,10 @@ declare namespace ide { export const client: {}; export const workbench: { + readonly action: Action, + readonly syncActionDescriptor: SyncActionDescriptor, readonly statusbarService: IStatusbarService; + readonly actionsRegistry: IWorkbenchActionRegistry; readonly notificationService: INotificationService; readonly storageService: IStorageService; readonly menuRegistry: IMenuRegistry; diff --git a/packages/vscode/src/client.ts b/packages/vscode/src/client.ts index 277f89bb..f783a36c 100644 --- a/packages/vscode/src/client.ts +++ b/packages/vscode/src/client.ts @@ -6,13 +6,17 @@ import { IStatusbarService, StatusbarAlignment } from "vs/platform/statusbar/com import * as paths from "./fill/paths"; import product from "./fill/product"; import "./vscode.scss"; -import { MenuId, MenuRegistry } from "vs/platform/actions/common/actions"; +import { Action } from 'vs/base/common/actions'; +import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions'; import { CommandsRegistry } from "vs/platform/commands/common/commands"; import { IFileService, FileOperation } from "vs/platform/files/common/files"; import { ITextFileService } from "vs/workbench/services/textfile/common/textfiles"; import { IModelService } from "vs/editor/common/services/modelService"; import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal"; import { IStorageService } from "vs/platform/storage/common/storage"; + // NOTE: shouldn't import anything from VS Code here or anything that will // depend on a synchronous fill like `os`. @@ -33,11 +37,12 @@ class VSClient extends IdeClient { window.ide = { client: ideClientInstance, workbench: { + action: Action, + syncActionDescriptor: SyncActionDescriptor, commandRegistry: CommandsRegistry, - // tslint:disable-next-line:no-any - menuRegistry: MenuRegistry as any, - // tslint:disable-next-line:no-any - statusbarService: getService(IStatusbarService) as any, + actionsRegistry: Registry.as(Extensions.WorkbenchActions), + menuRegistry: MenuRegistry, + statusbarService: getService(IStatusbarService), notificationService: getService(INotificationService), terminalService: getService(ITerminalService), storageService: {