From 2186ccb7e49fd151ba2ef9710536d1407753ca1e Mon Sep 17 00:00:00 2001 From: Roman Nikitenko Date: Tue, 1 Oct 2019 13:09:30 +0300 Subject: [PATCH] Align 'ActionProvider' related entities with VS Code Signed-off-by: Roman Nikitenko --- CHANGELOG.md | 1 + packages/core/src/common/quick-open-model.ts | 2 +- .../src/browser/monaco-quick-open-service.ts | 16 ++-------------- packages/monaco/src/typings/monaco/index.d.ts | 5 +---- .../task/src/browser/task-action-provider.ts | 2 +- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aa34338bb0b7..78244edf06212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Breaking changes: - `PluginDebugAdapterContribution.languages`, `PluginDebugAdapterContribution.getSchemaAttributes` and `PluginDebugAdapterContribution.getConfigurationSnippets` are removed to prevent sending the contributions second time to the frontend. Debug contributions are loaded statically from the deployed plugin metadata instead. The same for corresponding methods in `DebugExtImpl`. - [task] removed `watchedConfigFileUris`, `watchersMap` `watcherServer`, `fileSystem`, `configFileUris`, `watchConfigurationFile()` and `unwatchConfigurationFile()` from `TaskConfigurations` class. [6268](https://github.com/eclipse-theia/theia/pull/6268) - [task] removed `configurationFileFound` from `TaskService` class. [6268](https://github.com/eclipse-theia/theia/pull/6268) +- [core][monaco][task] aligh `ActionProvider` related entities with VS Code. [6302](https://github.com/eclipse-theia/theia/pull/6302) ## v0.11.0 diff --git a/packages/core/src/common/quick-open-model.ts b/packages/core/src/common/quick-open-model.ts index 1e06f4dd7aad7..14cc9c5aaf75a 100644 --- a/packages/core/src/common/quick-open-model.ts +++ b/packages/core/src/common/quick-open-model.ts @@ -111,7 +111,7 @@ export interface QuickOpenModel { export interface QuickOpenActionProvider { hasActions(item: QuickOpenItem): boolean; - getActions(item: QuickOpenItem): Promise; + getActions(item: QuickOpenItem): ReadonlyArray; } export interface QuickOpenActionOptions { diff --git a/packages/monaco/src/browser/monaco-quick-open-service.ts b/packages/monaco/src/browser/monaco-quick-open-service.ts index 84e992d226be8..353ae323fd264 100644 --- a/packages/monaco/src/browser/monaco-quick-open-service.ts +++ b/packages/monaco/src/browser/monaco-quick-open-service.ts @@ -531,22 +531,10 @@ export class MonacoQuickOpenActionProvider implements monaco.quickOpen.IActionPr } // tslint:disable-next-line:no-any - async getActions(element: any, entry: QuickOpenEntry | QuickOpenEntryGroup): Promise { - const actions = await this.provider.getActions(entry.item); + getActions(element: any, entry: QuickOpenEntry | QuickOpenEntryGroup): ReadonlyArray { + const actions = this.provider.getActions(entry.item); return actions.map(action => new MonacoQuickOpenAction(action)); } - - hasSecondaryActions(): boolean { - return false; - } - - async getSecondaryActions(): Promise { - return []; - } - - getActionItem(): undefined { - return undefined; - } } interface TheiaKeybindingService { diff --git a/packages/monaco/src/typings/monaco/index.d.ts b/packages/monaco/src/typings/monaco/index.d.ts index 06b57aa101b69..fa270f5b612a5 100644 --- a/packages/monaco/src/typings/monaco/index.d.ts +++ b/packages/monaco/src/typings/monaco/index.d.ts @@ -747,10 +747,7 @@ declare module monaco.quickOpen { export interface IActionProvider { hasActions(element: any, item: any): boolean; - getActions(element: any, item: any): Promise; - hasSecondaryActions(element: any, item: any): boolean; - getSecondaryActions(element: any, item: any): Promise; - getActionItem(element: any, item: any, action: IAction): any; + getActions(element: any, item: any): ReadonlyArray; } export class QuickOpenModel implements IModel, IDataSource, IFilter, IRunner { diff --git a/packages/task/src/browser/task-action-provider.ts b/packages/task/src/browser/task-action-provider.ts index 961a10ee44307..514fc73f1a23b 100644 --- a/packages/task/src/browser/task-action-provider.ts +++ b/packages/task/src/browser/task-action-provider.ts @@ -61,7 +61,7 @@ export class TaskActionProvider implements QuickOpenActionProvider { return true; } - async getActions(): Promise { + getActions(): ReadonlyArray { return [this.configureTaskAction]; } }