diff --git a/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts b/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts index af0ccb3dd2463611b764f51ba2b22a26bc68fa65..048a81e0334da32f2bdc67434f0e4e2319328ffa 100644 --- a/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts +++ b/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts @@ -142,7 +142,7 @@ export class AbstractKeybindingService { throw new Error('Not implemented'); } - public executeCommand(commandId: string, args:any): void { + public executeCommand(commandId: string, args:any): TPromise { throw new Error('Not implemented'); } } @@ -300,7 +300,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey delete this._contexts[String(contextId)]; } - public executeCommand(commandId: string, args:any = {}): any { + public executeCommand(commandId: string, args:any = {}): TPromise { if (!args.context) { var contextId = this._findContextAttr(document.activeElement); var context = this.getContext(contextId); @@ -309,9 +309,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey args.context = contextValue; } - return this._invokeHandler(commandId, args).done(undefined, err => { - this._messageService.show(Severity.Warning, err); - }); + return this._invokeHandler(commandId, args); } } @@ -356,8 +354,8 @@ class ScopedKeybindingService extends AbstractKeybindingService { this._parent.disposeContext(contextId); } - public executeCommand(commandId: string, args:any): void { - this._parent.executeCommand(commandId, args); + public executeCommand(commandId: string, args:any): TPromise { + return this._parent.executeCommand(commandId, args); } } diff --git a/src/vs/platform/keybinding/common/keybindingService.ts b/src/vs/platform/keybinding/common/keybindingService.ts index 634383082b1abf355c8032a223af71feac2b6a68..5d33814597c2dfc83f7bd9ac1b444f71da49d803 100644 --- a/src/vs/platform/keybinding/common/keybindingService.ts +++ b/src/vs/platform/keybinding/common/keybindingService.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import {TPromise} from 'vs/base/common/winjs.base'; import {createDecorator, IInstantiationService, ServiceIdentifier, ServicesAccessor} from 'vs/platform/instantiation/common/instantiation'; import {Keybinding} from 'vs/base/common/keyCodes'; @@ -82,5 +83,6 @@ export interface IKeybindingService { lookupKeybindings(commandId: string): Keybinding[]; customKeybindingsCount(): number; - executeCommand(commandId: string, args?: any): any; + executeCommand(commandId: string, args?: any): TPromise; + executeCommand(commandId: string, args?: any): TPromise; } diff --git a/src/vs/workbench/api/common/pluginHostCommands.ts b/src/vs/workbench/api/common/pluginHostCommands.ts index 20d9ca171a5f05532b99762504360d56e15ca2e8..43e01007d31af84775463eec17d341e242ed894b 100644 --- a/src/vs/workbench/api/common/pluginHostCommands.ts +++ b/src/vs/workbench/api/common/pluginHostCommands.ts @@ -148,7 +148,7 @@ export class MainThreadCommands { } _executeCommand(id: string, args: any[]): Thenable { - return TPromise.as(this._keybindingService.executeCommand(id, args)); + return this._keybindingService.executeCommand(id, args); } _getCommands(): Thenable { diff --git a/src/vs/workbench/test/browser/servicesTestUtils.ts b/src/vs/workbench/test/browser/servicesTestUtils.ts index 44c226bc3c21c8fdbc428129e0f5ab085960f6a0..fc87c3db398505aae60c9be04f4c556db5ab6d34 100644 --- a/src/vs/workbench/test/browser/servicesTestUtils.ts +++ b/src/vs/workbench/test/browser/servicesTestUtils.ts @@ -153,7 +153,7 @@ export class TestKeybindingService implements IKeybindingService { public setInstantiationService(instantiationService: IInstantiationService): void { } public setContext(key: string, value: any): void { } public removeContext(key: string): void { } - public executeCommand(commandId: string, args: any): void { } + public executeCommand(commandId: string, args: any): TPromise { return; } public createKey(key: string, defaultValue: T): IKeybindingContextKey { return null;