Split IKeybindingService

This commit is contained in:
Alex Dima 2016-08-12 15:56:13 +02:00
parent 0ed00c698f
commit 7f7d0b9f17
40 changed files with 487 additions and 468 deletions

View file

@ -18,7 +18,7 @@ import {IExtensionDescription} from 'vs/platform/extensions/common/extensions';
import {ICommandService, ICommandHandler} from 'vs/platform/commands/common/commands';
import {KeybindingService, KeybindingService2} from 'vs/platform/keybinding/browser/keybindingServiceImpl';
import {IOSupport} from 'vs/platform/keybinding/common/keybindingResolver';
import {IKeybindingItem} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingItem} from 'vs/platform/keybinding/common/keybinding';
import {IConfirmation, IMessageService} from 'vs/platform/message/common/message';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import * as editorCommon from 'vs/editor/common/editorCommon';
@ -200,19 +200,18 @@ export class SimpleMessageService implements IMessageService {
}
export class StandaloneKeybindingService2 extends KeybindingService2 {
}
export class StandaloneKeybindingService extends KeybindingService {
private static LAST_GENERATED_ID = 0;
private _dynamicKeybindings: IKeybindingItem[];
private _dynamicCommands: { [id: string]: ICommandHandler };
constructor(commandService: ICommandService, configurationService: IConfigurationService, messageService: IMessageService, domNode: HTMLElement) {
super(commandService, configurationService, messageService);
constructor(
keybindingService: IKeybindingService,
commandService: ICommandService,
messageService: IMessageService,
domNode: HTMLElement
) {
super(keybindingService, commandService, messageService);
this._dynamicKeybindings = [];
this._dynamicCommands = Object.create(null);
@ -222,7 +221,7 @@ export class StandaloneKeybindingService extends KeybindingService {
public addDynamicKeybinding(keybinding: number, handler:ICommandHandler, when:string, commandId:string = null): string {
if (commandId === null) {
commandId = 'DYNAMIC_' + (++StandaloneKeybindingService.LAST_GENERATED_ID);
commandId = 'DYNAMIC_' + (++StandaloneKeybindingService2.LAST_GENERATED_ID);
}
var parsedContext = IOSupport.readKeybindingWhen(when);
this._dynamicKeybindings.push({
@ -246,6 +245,12 @@ export class StandaloneKeybindingService extends KeybindingService {
}
}
export class StandaloneKeybindingService extends KeybindingService {
constructor(configurationService: IConfigurationService) {
super(configurationService);
}
}
export class SimpleExtensionService extends AbstractExtensionService<ActivatedExtension> {
constructor() {

View file

@ -9,13 +9,13 @@ import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ICommandService} from 'vs/platform/commands/common/commands';
import {IKeybindingContextKey, IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingContextKey, IKeybindingService, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {ICommandHandler} from 'vs/platform/commands/common/commands';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IActionDescriptor, ICodeEditorWidgetCreationOptions, IDiffEditorOptions, IModel, IModelChangedEvent, EventType} from 'vs/editor/common/editorCommon';
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerService';
import {StandaloneKeybindingService} from 'vs/editor/browser/standalone/simpleServices';
import {StandaloneKeybindingService2} from 'vs/editor/browser/standalone/simpleServices';
import {IEditorContextViewService, IEditorOverrideServices, ensureStaticPlatformServices, getOrCreateStaticServices} from 'vs/editor/browser/standalone/standaloneServices';
import {CodeEditorWidget} from 'vs/editor/browser/widget/codeEditorWidget';
import {DiffEditorWidget} from 'vs/editor/browser/widget/diffEditorWidget';
@ -57,7 +57,7 @@ export interface IStandaloneDiffEditor extends IDiffEditor {
export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCodeEditor {
private _standaloneKeybindingService: StandaloneKeybindingService;
private _standaloneKeybindingService: StandaloneKeybindingService2;
private _contextViewService:IEditorContextViewService;
private _ownsModel:boolean;
private _toDispose2: IDisposable[];
@ -70,14 +70,15 @@ export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCod
@ICodeEditorService codeEditorService: ICodeEditorService,
@ICommandService commandService: ICommandService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@ITelemetryService telemetryService: ITelemetryService,
@IContextViewService contextViewService: IContextViewService
) {
options = options || {};
super(domElement, options, instantiationService, codeEditorService, commandService, keybindingService.createScoped(domElement), telemetryService);
if (keybindingService instanceof StandaloneKeybindingService) {
this._standaloneKeybindingService = <StandaloneKeybindingService>keybindingService;
if (keybindingService2 instanceof StandaloneKeybindingService2) {
this._standaloneKeybindingService = keybindingService2;
}
this._contextViewService = <IEditorContextViewService>contextViewService;
@ -125,7 +126,7 @@ export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCod
console.warn('Cannot create context key because the editor is configured with an unrecognized KeybindingService');
return null;
}
return this._standaloneKeybindingService.createKey(key, defaultValue);
return this._keybindingService.createKey(key, defaultValue);
}
public addAction(descriptor:IActionDescriptor): void {
@ -163,7 +164,7 @@ export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCod
export class StandaloneDiffEditor extends DiffEditorWidget implements IStandaloneDiffEditor {
private _contextViewService:IEditorContextViewService;
private _standaloneKeybindingService: StandaloneKeybindingService;
private _standaloneKeybindingService: StandaloneKeybindingService2;
private _toDispose2: IDisposable[];
constructor(
@ -172,13 +173,14 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
toDispose: IDisposable[],
@IInstantiationService instantiationService: IInstantiationService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IContextViewService contextViewService: IContextViewService,
@IEditorWorkerService editorWorkerService: IEditorWorkerService
) {
super(domElement, options, editorWorkerService, keybindingService, instantiationService);
if (keybindingService instanceof StandaloneKeybindingService) {
this._standaloneKeybindingService = <StandaloneKeybindingService>keybindingService;
if (keybindingService2 instanceof StandaloneKeybindingService2) {
this._standaloneKeybindingService = keybindingService2;
}
this._contextViewService = <IEditorContextViewService>contextViewService;
@ -210,7 +212,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
console.warn('Cannot create context key because the editor is configured with an unrecognized KeybindingService');
return null;
}
return this._standaloneKeybindingService.createKey(key, defaultValue);
return this._keybindingService.createKey(key, defaultValue);
}
public addAction(descriptor:IActionDescriptor): void {

View file

@ -191,26 +191,33 @@ export function ensureStaticPlatformServices(services: IEditorOverrideServices):
}
export function ensureDynamicPlatformServices(domElement:HTMLElement, services: IEditorOverrideServices): IDisposable[] {
var r:IDisposable[] = [];
let r:IDisposable[] = [];
let keybindingService:IKeybindingService;
if (typeof services.keybindingService === 'undefined') {
var keybindingService = new StandaloneKeybindingService(services.commandService, services.configurationService, services.messageService, domElement);
keybindingService = new StandaloneKeybindingService(services.configurationService);
r.push(keybindingService);
services.keybindingService = keybindingService;
} else {
keybindingService = services.keybindingService;
}
if (typeof services.keybindingService2 === 'undefined') {
var keybindingService2 = new StandaloneKeybindingService2();
let keybindingService2 = new StandaloneKeybindingService2(keybindingService, services.commandService, services.messageService, domElement);
r.push(keybindingService2);
services.keybindingService2 = keybindingService2;
}
let contextViewService:IEditorContextViewService;
if (typeof services.contextViewService === 'undefined') {
var contextViewService = new ContextViewService(domElement, services.telemetryService, services.messageService);
contextViewService = new ContextViewService(domElement, services.telemetryService, services.messageService);
r.push(contextViewService);
services.contextViewService = contextViewService;
} else {
contextViewService = services.contextViewService;
}
if (typeof services.contextMenuService === 'undefined') {
var contextMenuService = new ContextMenuService(domElement, services.telemetryService, services.messageService, contextViewService);
let contextMenuService = new ContextMenuService(domElement, services.telemetryService, services.messageService, contextViewService);
r.push(contextMenuService);
services.contextMenuService = contextMenuService;
}

View file

@ -204,7 +204,7 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
private _updateDecorationsRunner:RunOnceScheduler;
private _editorWorkerService: IEditorWorkerService;
private _keybindingService: IKeybindingService;
protected _keybindingService: IKeybindingService;
constructor(
domElement:HTMLElement,

View file

@ -15,7 +15,7 @@ import {renderHtml} from 'vs/base/browser/htmlContentRenderer';
import {StyleMutator} from 'vs/base/browser/styleMutator';
import {Widget} from 'vs/base/browser/ui/widget';
import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation';
import {KbCtxKey, IKeybindingContextKey, IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {KbCtxKey, IKeybindingContextKey, IKeybindingService, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {GlobalScreenReaderNVDA} from 'vs/editor/common/config/commonEditorConfig';
import {ICommonCodeEditor, IEditorContribution, EditorContextKeys} from 'vs/editor/common/editorCommon';
@ -38,11 +38,15 @@ class AccessibilityHelpController extends Disposable implements IEditorContribut
private _editor: ICodeEditor;
private _widget: AccessibilityHelpWidget;
constructor(editor:ICodeEditor, @IKeybindingService keybindingService: IKeybindingService) {
constructor(
editor:ICodeEditor,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2
) {
super();
this._editor = editor;
this._widget = this._register(new AccessibilityHelpWidget(this._editor, keybindingService));
this._widget = this._register(new AccessibilityHelpWidget(this._editor, keybindingService, keybindingService2));
}
public getId(): string {
@ -65,16 +69,16 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
private static HEIGHT = 300;
private _editor: ICodeEditor;
private _keybindingService: IKeybindingService;
private _keybindingService2: IKeybindingService2;
private _domNode: HTMLElement;
private _isVisible: boolean;
private _isVisibleKey: IKeybindingContextKey<boolean>;
constructor(editor:ICodeEditor, keybindingService: IKeybindingService) {
constructor(editor:ICodeEditor, keybindingService: IKeybindingService, keybindingService2: IKeybindingService2) {
super();
this._editor = editor;
this._keybindingService = keybindingService;
this._keybindingService2 = keybindingService2;
this._isVisibleKey = CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE.bindTo(keybindingService);
this._domNode = document.createElement('div');
@ -133,9 +137,9 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
}
private _descriptionForCommand(commandId:string, msg:string, noKbMsg:string): string {
let keybindings = this._keybindingService.lookupKeybindings(commandId);
let keybindings = this._keybindingService2.lookupKeybindings(commandId);
if (keybindings.length > 0) {
return strings.format(msg, this._keybindingService.getAriaLabelFor(keybindings[0]));
return strings.format(msg, this._keybindingService2.getAriaLabelFor(keybindings[0]));
}
return strings.format(noKbMsg, commandId);
}

View file

@ -13,7 +13,7 @@ import * as dom from 'vs/base/browser/dom';
import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {ActionItem, Separator} from 'vs/base/browser/ui/actionbar/actionbar';
import {IContextMenuService, IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IMenuService, IMenu, MenuId} from 'vs/platform/actions/common/actions';
import {ICommonCodeEditor, IEditorContribution, MouseTargetType, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
@ -43,6 +43,7 @@ class ContextMenuController implements IEditorContribution {
@IContextMenuService private _contextMenuService: IContextMenuService,
@IContextViewService private _contextViewService: IContextViewService,
@IKeybindingService private _keybindingService: IKeybindingService,
@IKeybindingService2 private _keybindingService2: IKeybindingService2,
@IMenuService private _menuService: IMenuService
) {
this._editor = editor;
@ -175,7 +176,7 @@ class ContextMenuController implements IEditorContribution {
getActionItem: (action) => {
var keybinding = this._keybindingFor(action);
if (keybinding) {
return new ActionItem(action, action, { label: true, keybinding: this._keybindingService.getLabelFor(keybinding) });
return new ActionItem(action, action, { label: true, keybinding: this._keybindingService2.getLabelFor(keybinding) });
}
var customActionItem = <any>action;
@ -202,7 +203,7 @@ class ContextMenuController implements IEditorContribution {
}
private _keybindingFor(action: IAction): Keybinding {
var opts = this._keybindingService.lookupKeybindings(action.id);
var opts = this._keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}

View file

@ -16,7 +16,7 @@ import {renderHtml} from 'vs/base/browser/htmlContentRenderer';
import {StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {StyleMutator} from 'vs/base/browser/styleMutator';
import {IOSupport} from 'vs/platform/keybinding/common/keybindingResolver';
import {KbExpr, IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {KbExpr, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
@ -43,7 +43,7 @@ export class DefineKeybindingController implements editorCommon.IEditorContribut
}
private _editor: ICodeEditor;
private _keybindingService:IKeybindingService;
private _keybindingService2:IKeybindingService2;
private _launchWidget: DefineKeybindingLauncherWidget;
private _defineWidget: DefineKeybindingWidget;
private _toDispose: IDisposable[];
@ -52,13 +52,13 @@ export class DefineKeybindingController implements editorCommon.IEditorContribut
constructor(
editor:ICodeEditor,
@IKeybindingService keybindingService:IKeybindingService
@IKeybindingService2 keybindingService2:IKeybindingService2
) {
this._editor = editor;
this._keybindingService = keybindingService;
this._keybindingService2 = keybindingService2;
this._toDispose = [];
this._launchWidget = new DefineKeybindingLauncherWidget(this._editor, keybindingService, () => this.launch());
this._defineWidget = new DefineKeybindingWidget(this._editor, keybindingService, (keybinding) => this._onAccepted(keybinding));
this._launchWidget = new DefineKeybindingLauncherWidget(this._editor, keybindingService2, () => this.launch());
this._defineWidget = new DefineKeybindingWidget(this._editor, keybindingService2, (keybinding) => this._onAccepted(keybinding));
this._toDispose.push(this._editor.onDidChangeConfiguration((e) => {
if (isInterestingEditorModel(this._editor)) {
@ -162,7 +162,7 @@ export class DefineKeybindingController implements editorCommon.IEditorContribut
strKeybinding: strKeybinding,
keybinding: keybinding,
usLabel: keybinding._toUSLabel(),
label: this._keybindingService.getLabelFor(keybinding),
label: this._keybindingService2.getLabelFor(keybinding),
range: range
};
});
@ -187,7 +187,7 @@ export class DefineKeybindingController implements editorCommon.IEditorContribut
} else {
// this is the info case
msg = [NLS_KB_LAYOUT_INFO_MESSAGE];
msg = msg.concat(this._keybindingService.getLabelFor(item.keybinding));
msg = msg.concat(this._keybindingService2.getLabelFor(item.keybinding));
className = 'keybindingInfo';
inlineClassName = 'inlineKeybindingInfo';
overviewRulerColor = 'rgba(100, 100, 250, 0.6)';
@ -232,16 +232,16 @@ class DefineKeybindingLauncherWidget implements IOverlayWidget {
private _toDispose: IDisposable[];
private _isVisible: boolean;
constructor(editor:ICodeEditor, keybindingService:IKeybindingService, onLaunch:()=>void) {
constructor(editor:ICodeEditor, keybindingService2:IKeybindingService2, onLaunch:()=>void) {
this._editor = editor;
this._domNode = document.createElement('div');
this._domNode.className = 'defineKeybindingLauncher';
this._domNode.style.display = 'none';
this._isVisible = false;
let keybinding = keybindingService.lookupKeybindings(DefineKeybindingAction.ID);
let keybinding = keybindingService2.lookupKeybindings(DefineKeybindingAction.ID);
let extra = '';
if (keybinding.length > 0) {
extra += ' ('+keybindingService.getLabelFor(keybinding[0])+')';
extra += ' ('+keybindingService2.getLabelFor(keybinding[0])+')';
}
this._domNode.appendChild(document.createTextNode(NLS_LAUNCH_MESSAGE + extra));
@ -301,7 +301,7 @@ class DefineKeybindingWidget implements IOverlayWidget {
private static HEIGHT = 90;
private _editor: ICodeEditor;
private _keybindingService:IKeybindingService;
private _keybindingService2:IKeybindingService2;
private _domNode: HTMLElement;
private _toDispose: IDisposable[];
@ -314,9 +314,9 @@ class DefineKeybindingWidget implements IOverlayWidget {
private _onAccepted: (keybinding:string) => void;
private _isVisible: boolean;
constructor(editor:ICodeEditor, keybindingService:IKeybindingService, onAccepted:(keybinding:string) => void) {
constructor(editor:ICodeEditor, keybindingService2:IKeybindingService2, onAccepted:(keybinding:string) => void) {
this._editor = editor;
this._keybindingService = keybindingService;
this._keybindingService2 = keybindingService2;
this._onAccepted = onAccepted;
this._toDispose = [];
this._lastKeybinding = null;
@ -368,7 +368,7 @@ class DefineKeybindingWidget implements IOverlayWidget {
this._inputNode.title = 'keyCode: ' + keyEvent.browserEvent.keyCode;
dom.clearNode(this._outputNode);
let htmlkb = this._keybindingService.getHTMLLabelFor(this._lastKeybinding);
let htmlkb = this._keybindingService2.getHTMLLabelFor(this._lastKeybinding);
htmlkb.forEach((item) => this._outputNode.appendChild(renderHtml(item)));
}));
this._toDispose.push(this._editor.onDidChangeConfiguration((e) => {

View file

@ -5,7 +5,7 @@
'use strict';
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {ICodeEditor} from 'vs/editor/browser/editorBrowser';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {FindWidget, IFindController} from 'vs/editor/contrib/find/browser/findWidget';
@ -15,10 +15,15 @@ class FindController extends CommonFindController implements IFindController {
private _widget: FindWidget;
constructor(editor:ICodeEditor, @IContextViewService contextViewService: IContextViewService, @IKeybindingService keybindingService: IKeybindingService) {
constructor(
editor:ICodeEditor,
@IContextViewService contextViewService: IContextViewService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2
) {
super(editor, keybindingService);
this._widget = this._register(new FindWidget(editor, this, this._state, contextViewService, keybindingService));
this._widget = this._register(new FindWidget(editor, this, this._state, contextViewService, keybindingService2));
}
protected _start(opts:IFindStartOptions): void {

View file

@ -16,7 +16,7 @@ import {IContextViewProvider} from 'vs/base/browser/ui/contextview/contextview';
import {FindInput} from 'vs/base/browser/ui/findinput/findInput';
import {IMessage as InputBoxMessage, InputBox} from 'vs/base/browser/ui/inputbox/inputBox';
import {Widget} from 'vs/base/browser/ui/widget';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IConfigurationChangedEvent} from 'vs/editor/common/editorCommon';
import {ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, OverlayWidgetPositionPreference} from 'vs/editor/browser/editorBrowser';
import {FIND_IDS, MATCHES_LIMIT} from 'vs/editor/contrib/find/common/findModel';
@ -54,7 +54,7 @@ export class FindWidget extends Widget implements IOverlayWidget {
private _state: FindReplaceState;
private _controller: IFindController;
private _contextViewProvider: IContextViewProvider;
private _keybindingService: IKeybindingService;
private _keybindingService2: IKeybindingService2;
private _domNode: HTMLElement;
private _findInput: FindInput;
@ -79,14 +79,14 @@ export class FindWidget extends Widget implements IOverlayWidget {
controller: IFindController,
state: FindReplaceState,
contextViewProvider: IContextViewProvider,
keybindingService: IKeybindingService
keybindingService2: IKeybindingService2
) {
super();
this._codeEditor = codeEditor;
this._controller = controller;
this._state = state;
this._contextViewProvider = contextViewProvider;
this._keybindingService = keybindingService;
this._keybindingService2 = keybindingService2;
this._isVisible = false;
this._isReplaceVisible = false;
@ -372,11 +372,11 @@ export class FindWidget extends Widget implements IOverlayWidget {
// ----- initialization
private _keybindingLabelFor(actionId:string): string {
let keybindings = this._keybindingService.lookupKeybindings(actionId);
let keybindings = this._keybindingService2.lookupKeybindings(actionId);
if (keybindings.length === 0) {
return '';
}
return ' (' + this._keybindingService.getLabelFor(keybindings[0]) + ')';
return ' (' + this._keybindingService2.getLabelFor(keybindings[0]) + ')';
}
private _buildFindPart(): HTMLElement {

View file

@ -10,7 +10,7 @@ import {matchesFuzzy} from 'vs/base/common/filters';
import {TPromise} from 'vs/base/common/winjs.base';
import {IContext, IHighlight, QuickOpenEntryGroup, QuickOpenModel} from 'vs/base/parts/quickopen/browser/quickOpenModel';
import {IAutoFocus, Mode} from 'vs/base/parts/quickopen/common/quickOpen';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IEditorAction, ICommonCodeEditor, IEditor, EditorContextKeys} from 'vs/editor/common/editorCommon';
import {BaseEditorQuickOpenAction} from './editorQuickOpen';
import {editorAction, ServicesAccessor} from 'vs/editor/common/editorCommonExtensions';
@ -86,11 +86,11 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction {
}
public run(accessor:ServicesAccessor, editor:ICommonCodeEditor): void {
const keybindingService = accessor.get(IKeybindingService);
const keybindingService2 = accessor.get(IKeybindingService2);
this._show(this.getController(editor), {
getModel: (value:string):QuickOpenModel => {
return new QuickOpenModel(this._editorActionsToEntries(keybindingService, editor, value));
return new QuickOpenModel(this._editorActionsToEntries(keybindingService2, editor, value));
},
getAutoFocus: (searchValue:string):IAutoFocus => {
@ -109,14 +109,14 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction {
return elementAName.localeCompare(elementBName);
}
private _editorActionsToEntries(keybindingService:IKeybindingService, editor:ICommonCodeEditor, searchValue: string): EditorActionCommandEntry[] {
private _editorActionsToEntries(keybindingService2:IKeybindingService2, editor:ICommonCodeEditor, searchValue: string): EditorActionCommandEntry[] {
let actions: IEditorAction[] = editor.getSupportedActions();
let entries: EditorActionCommandEntry[] = [];
for (let i = 0; i < actions.length; i++) {
let action = actions[i];
let keys = keybindingService.lookupKeybindings(action.id).map(k => keybindingService.getLabelFor(k));
let keys = keybindingService2.lookupKeybindings(action.id).map(k => keybindingService2.getLabelFor(k));
if (action.label) {
let highlights = matchesFuzzy(searchValue, action.label);

View file

@ -17,7 +17,7 @@ import { IDelegate, IFocusChangeEvent, IRenderer, ISelectionChangeEvent } from '
import { List } from 'vs/base/browser/ui/list/listWidget';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingContextKey, IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IKeybindingContextKey, IKeybindingService, IKeybindingService2 } from 'vs/platform/keybinding/common/keybinding';
import { IConfigurationChangedEvent } from 'vs/editor/common/editorCommon';
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { Context as SuggestContext } from '../common/suggest';
@ -46,10 +46,10 @@ class Renderer implements IRenderer<CompletionItem, ISuggestionTemplateData> {
constructor(
private widget: SuggestWidget,
private editor: ICodeEditor,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService2 keybindingService2: IKeybindingService2
) {
const keybindings = keybindingService.lookupKeybindings('editor.action.triggerSuggest');
this.triggerKeybindingLabel = keybindings.length === 0 ? '' : ` (${keybindingService.getLabelFor(keybindings[0])})`;
const keybindings = keybindingService2.lookupKeybindings('editor.action.triggerSuggest');
this.triggerKeybindingLabel = keybindings.length === 0 ? '' : ` (${keybindingService2.getLabelFor(keybindings[0])})`;
}
get templateId(): string {

View file

@ -6,7 +6,7 @@
'use strict';
import {localize} from 'vs/nls';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IMenu, MenuItemAction} from 'vs/platform/actions/common/actions';
import {IMessageService} from 'vs/platform/message/common/message';
import Severity from 'vs/base/common/severity';
@ -63,9 +63,9 @@ export function fillInActions(menu: IMenu, target: IAction[] | { primary: IActio
}
export function createActionItem(action: IAction, keybindingService: IKeybindingService, messageService: IMessageService): ActionItem {
export function createActionItem(action: IAction, keybindingService2: IKeybindingService2, messageService: IMessageService): ActionItem {
if (action instanceof MenuItemAction) {
return new MenuItemActionItem(action, keybindingService, messageService);
return new MenuItemActionItem(action, keybindingService2, messageService);
}
}
@ -94,7 +94,7 @@ class MenuItemActionItem extends ActionItem {
constructor(
action: MenuItemAction,
@IKeybindingService private _keybindingService: IKeybindingService,
@IKeybindingService2 private _keybindingService2: IKeybindingService2,
@IMessageService private _messageService: IMessageService
) {
super(undefined, action, { icon: !!action.command.iconClass, label: !action.command.iconClass });
@ -151,8 +151,8 @@ class MenuItemActionItem extends ActionItem {
_updateTooltip(): void {
const element = this.$e.getHTMLElement();
const keybinding = this._keybindingService.lookupKeybindings(this._command.id)[0];
const keybindingLabel = keybinding && this._keybindingService.getLabelFor(keybinding);
const keybinding = this._keybindingService2.lookupKeybindings(this._command.id)[0];
const keybindingLabel = keybinding && this._keybindingService2.getLabelFor(keybinding);
element.title = keybindingLabel
? localize('titleAndKb', "{0} ({1})", this._command.title, keybindingLabel)

View file

@ -148,12 +148,172 @@ class KeybindingContextKey<T> implements IKeybindingContextKey<T> {
export class KeybindingService2 implements IKeybindingService2 {
public _serviceBrand: any;
constructor() {
private _toDispose: IDisposable[] = [];
private _cachedResolver: KeybindingResolver;
private _firstTimeComputingResolver: boolean;
private _currentChord: number;
private _currentChordStatusMessage: IDisposable;
private _keybindingService: IKeybindingService;
private _commandService: ICommandService;
private _statusService: IStatusbarService;
private _messageService: IMessageService;
constructor(
keybindingService: IKeybindingService,
commandService: ICommandService,
messageService: IMessageService,
statusService?: IStatusbarService
) {
this._keybindingService = keybindingService;
this._commandService = commandService;
this._statusService = statusService;
this._messageService = messageService;
this._cachedResolver = null;
this._firstTimeComputingResolver = true;
this._currentChord = 0;
this._currentChordStatusMessage = null;
}
public dispose(): void {
this._toDispose = dispose(this._toDispose);
}
protected _beginListening(domNode: HTMLElement): void {
this._toDispose.push(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let keyEvent = new StandardKeyboardEvent(e);
this._dispatch(keyEvent);
}));
}
private _getResolver(): KeybindingResolver {
if (!this._cachedResolver) {
this._cachedResolver = new KeybindingResolver(KeybindingsRegistry.getDefaultKeybindings(), this._getExtraKeybindings(this._firstTimeComputingResolver));
this._firstTimeComputingResolver = false;
}
return this._cachedResolver;
}
public getLabelFor(keybinding: Keybinding): string {
return keybinding._toUSLabel();
}
public getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[] {
return keybinding._toUSHTMLLabel();
}
public getAriaLabelFor(keybinding: Keybinding): string {
return keybinding._toUSAriaLabel();
}
public getElectronAcceleratorFor(keybinding: Keybinding): string {
return keybinding._toElectronAccelerator();
}
protected updateResolver(): void {
this._cachedResolver = null;
}
protected _getExtraKeybindings(isFirstTime: boolean): IKeybindingItem[] {
return [];
}
public getDefaultKeybindings(): string {
return this._getResolver().getDefaultKeybindings() + '\n\n' + this._getAllCommandsAsComment();
}
public customKeybindingsCount(): number {
return 0;
}
public lookupKeybindings(commandId: string): Keybinding[] {
return this._getResolver().lookupKeybinding(commandId);
}
private _getAllCommandsAsComment(): string {
const commands = CommandsRegistry.getCommands();
const unboundCommands: string[] = [];
const boundCommands = this._getResolver().getDefaultBoundCommands();
for (let id in commands) {
if (id[0] === '_' || id.indexOf('vscode.') === 0) { // private command
continue;
}
if (typeof commands[id].description === 'object'
&& !isFalsyOrEmpty((<ICommandHandlerDescription>commands[id].description).args)) { // command with args
continue;
}
if (boundCommands[id]) {
continue;
}
unboundCommands.push(id);
}
let pretty = unboundCommands.sort().join('\n// - ');
return '// ' + nls.localize('unboundCommands', "Here are other available commands: ") + '\n// - ' + pretty;
}
protected _getCommandHandler(commandId: string): ICommandHandler {
return CommandsRegistry.getCommand(commandId).handler;
}
private _dispatch(e: IKeyboardEvent): void {
let isModifierKey = (e.keyCode === KeyCode.Ctrl || e.keyCode === KeyCode.Shift || e.keyCode === KeyCode.Alt || e.keyCode === KeyCode.Meta);
if (isModifierKey) {
return;
}
let contextValue = Object.create(null);
this._keybindingService.getContext(this._findContextAttr(e.target)).fillInContext(contextValue);
// console.log(JSON.stringify(contextValue, null, '\t'));
let resolveResult = this._getResolver().resolve(contextValue, this._currentChord, e.asKeybinding());
if (resolveResult && resolveResult.enterChord) {
e.preventDefault();
this._currentChord = resolveResult.enterChord;
if (this._statusService) {
let firstPartLabel = this.getLabelFor(new Keybinding(this._currentChord));
this._currentChordStatusMessage = this._statusService.setStatusMessage(nls.localize('first.chord', "({0}) was pressed. Waiting for second key of chord...", firstPartLabel));
}
return;
}
if (this._statusService && this._currentChord) {
if (!resolveResult || !resolveResult.commandId) {
let firstPartLabel = this.getLabelFor(new Keybinding(this._currentChord));
let chordPartLabel = this.getLabelFor(new Keybinding(e.asKeybinding()));
this._statusService.setStatusMessage(nls.localize('missing.chord', "The key combination ({0}, {1}) is not a command.", firstPartLabel, chordPartLabel), 10 * 1000 /* 10s */);
e.preventDefault();
}
}
if (this._currentChordStatusMessage) {
this._currentChordStatusMessage.dispose();
this._currentChordStatusMessage = null;
}
this._currentChord = 0;
if (resolveResult && resolveResult.commandId) {
if (!/^\^/.test(resolveResult.commandId)) {
e.preventDefault();
}
let commandId = resolveResult.commandId.replace(/^\^/, '');
this._commandService.executeCommand(commandId, {}).done(undefined, err => {
this._messageService.show(Severity.Warning, err);
});
}
}
private _findContextAttr(domNode: HTMLElement): number {
while (domNode) {
if (domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {
return parseInt(domNode.getAttribute(KEYBINDING_CONTEXT_ATTR), 10);
}
domNode = domNode.parentElement;
}
return 0;
}
}
@ -217,16 +377,9 @@ export abstract class AbstractKeybindingService {
}
}
public abstract getLabelFor(keybinding: Keybinding): string;
public abstract getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[];
public abstract getAriaLabelFor(keybinding: Keybinding): string;
public abstract getElectronAcceleratorFor(keybinding: Keybinding): string;
public abstract customKeybindingsCount(): number;
public abstract getContext(contextId: number): KeybindingContext;
public abstract createChildContext(parentContextId?: number): number;
public abstract disposeContext(contextId: number): void;
public abstract getDefaultKeybindings(): string;
public abstract lookupKeybindings(commandId: string): Keybinding[];
}
@ -238,15 +391,8 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
};
private _toDispose: IDisposable[] = [];
private _cachedResolver: KeybindingResolver;
private _firstTimeComputingResolver: boolean;
private _currentChord: number;
private _currentChordStatusMessage: IDisposable;
private _commandService: ICommandService;
private _statusService: IStatusbarService;
private _messageService: IMessageService;
constructor(commandService: ICommandService, configurationService: IConfigurationService, messageService: IMessageService, statusService?: IStatusbarService) {
constructor(configurationService: IConfigurationService) {
super(0);
this._lastContextId = 0;
this._contexts = Object.create(null);
@ -255,14 +401,6 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
this._contexts[String(this._myContextId)] = myContext;
this._toDispose.push(myContext);
this._cachedResolver = null;
this._firstTimeComputingResolver = true;
this._currentChord = 0;
this._currentChordStatusMessage = null;
this._commandService = commandService;
this._statusService = statusService;
this._messageService = messageService;
// Uncomment this to see the contexts continuously logged
// let lastLoggedValue: string = null;
// setInterval(() => {
@ -275,146 +413,10 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
// }, 2000);
}
protected _beginListening(domNode: HTMLElement): void {
this._toDispose.push(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let keyEvent = new StandardKeyboardEvent(e);
this._dispatch(keyEvent);
}));
}
private _getResolver(): KeybindingResolver {
if (!this._cachedResolver) {
this._cachedResolver = new KeybindingResolver(KeybindingsRegistry.getDefaultKeybindings(), this._getExtraKeybindings(this._firstTimeComputingResolver));
this._firstTimeComputingResolver = false;
}
return this._cachedResolver;
}
public dispose(): void {
this._toDispose = dispose(this._toDispose);
}
public getLabelFor(keybinding: Keybinding): string {
return keybinding._toUSLabel();
}
public getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[] {
return keybinding._toUSHTMLLabel();
}
public getAriaLabelFor(keybinding: Keybinding): string {
return keybinding._toUSAriaLabel();
}
public getElectronAcceleratorFor(keybinding: Keybinding): string {
return keybinding._toElectronAccelerator();
}
protected updateResolver(): void {
this._cachedResolver = null;
}
protected _getExtraKeybindings(isFirstTime: boolean): IKeybindingItem[] {
return [];
}
public getDefaultKeybindings(): string {
return this._getResolver().getDefaultKeybindings() + '\n\n' + this._getAllCommandsAsComment();
}
public customKeybindingsCount(): number {
return 0;
}
public lookupKeybindings(commandId: string): Keybinding[] {
return this._getResolver().lookupKeybinding(commandId);
}
private _getAllCommandsAsComment(): string {
const commands = CommandsRegistry.getCommands();
const unboundCommands: string[] = [];
const boundCommands = this._getResolver().getDefaultBoundCommands();
for (let id in commands) {
if (id[0] === '_' || id.indexOf('vscode.') === 0) { // private command
continue;
}
if (typeof commands[id].description === 'object'
&& !isFalsyOrEmpty((<ICommandHandlerDescription>commands[id].description).args)) { // command with args
continue;
}
if (boundCommands[id]) {
continue;
}
unboundCommands.push(id);
}
let pretty = unboundCommands.sort().join('\n// - ');
return '// ' + nls.localize('unboundCommands', "Here are other available commands: ") + '\n// - ' + pretty;
}
protected _getCommandHandler(commandId: string): ICommandHandler {
return CommandsRegistry.getCommand(commandId).handler;
}
private _dispatch(e: IKeyboardEvent): void {
let isModifierKey = (e.keyCode === KeyCode.Ctrl || e.keyCode === KeyCode.Shift || e.keyCode === KeyCode.Alt || e.keyCode === KeyCode.Meta);
if (isModifierKey) {
return;
}
let contextValue = Object.create(null);
this.getContext(this._findContextAttr(e.target)).fillInContext(contextValue);
// console.log(JSON.stringify(contextValue, null, '\t'));
let resolveResult = this._getResolver().resolve(contextValue, this._currentChord, e.asKeybinding());
if (resolveResult && resolveResult.enterChord) {
e.preventDefault();
this._currentChord = resolveResult.enterChord;
if (this._statusService) {
let firstPartLabel = this.getLabelFor(new Keybinding(this._currentChord));
this._currentChordStatusMessage = this._statusService.setStatusMessage(nls.localize('first.chord', "({0}) was pressed. Waiting for second key of chord...", firstPartLabel));
}
return;
}
if (this._statusService && this._currentChord) {
if (!resolveResult || !resolveResult.commandId) {
let firstPartLabel = this.getLabelFor(new Keybinding(this._currentChord));
let chordPartLabel = this.getLabelFor(new Keybinding(e.asKeybinding()));
this._statusService.setStatusMessage(nls.localize('missing.chord', "The key combination ({0}, {1}) is not a command.", firstPartLabel, chordPartLabel), 10 * 1000 /* 10s */);
e.preventDefault();
}
}
if (this._currentChordStatusMessage) {
this._currentChordStatusMessage.dispose();
this._currentChordStatusMessage = null;
}
this._currentChord = 0;
if (resolveResult && resolveResult.commandId) {
if (!/^\^/.test(resolveResult.commandId)) {
e.preventDefault();
}
let commandId = resolveResult.commandId.replace(/^\^/, '');
this._commandService.executeCommand(commandId, {}).done(undefined, err => {
this._messageService.show(Severity.Warning, err);
});
}
}
private _findContextAttr(domNode: HTMLElement): number {
while (domNode) {
if (domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {
return parseInt(domNode.getAttribute(KEYBINDING_CONTEXT_ATTR), 10);
}
domNode = domNode.parentElement;
}
return this._myContextId;
}
public getContext(contextId: number): KeybindingContext {
return this._contexts[String(contextId)];
}
@ -456,34 +458,6 @@ class ScopedKeybindingService extends AbstractKeybindingService {
return this._parent.onDidChangeContext;
}
public getLabelFor(keybinding: Keybinding): string {
return this._parent.getLabelFor(keybinding);
}
public getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[] {
return this._parent.getHTMLLabelFor(keybinding);
}
public getAriaLabelFor(keybinding: Keybinding): string {
return this._parent.getAriaLabelFor(keybinding);
}
public getElectronAcceleratorFor(keybinding: Keybinding): string {
return this._parent.getElectronAcceleratorFor(keybinding);
}
public getDefaultKeybindings(): string {
return this._parent.getDefaultKeybindings();
}
public customKeybindingsCount(): number {
return this._parent.customKeybindingsCount();
}
public lookupKeybindings(commandId: string): Keybinding[] {
return this._parent.lookupKeybindings(commandId);
}
public getContext(contextId: number): KeybindingContext {
return this._parent.getContext(contextId);
}

View file

@ -483,19 +483,25 @@ export interface IKeybindingService {
createScoped(domNode: IKeybindingScopeLocation): IKeybindingService;
getDefaultKeybindings(): string;
lookupKeybindings(commandId: string): Keybinding[];
customKeybindingsCount(): number;
getContext(contextId: number): IKeybindingContext;
}
getLabelFor(keybinding: Keybinding): string;
getAriaLabelFor(keybinding: Keybinding): string;
getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[];
getElectronAcceleratorFor(keybinding: Keybinding): string;
export interface IKeybindingContext {
fillInContext(bucket: any): void;
}
export let IKeybindingService2 = createDecorator<IKeybindingService2>('keybindingService2');
export interface IKeybindingService2 {
_serviceBrand: any;
getLabelFor(keybinding: Keybinding): string;
getAriaLabelFor(keybinding: Keybinding): string;
getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[];
getElectronAcceleratorFor(keybinding: Keybinding): string;
getDefaultKeybindings(): string;
lookupKeybindings(commandId: string): Keybinding[];
customKeybindingsCount(): number;
}
export const SET_CONTEXT_COMMAND_ID = 'setContext';

View file

@ -7,7 +7,7 @@
import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import {Keybinding} from 'vs/base/common/keyCodes';
import Event from 'vs/base/common/event';
import {IKeybindingContextKey, IKeybindingService, KbExpr} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingContextKey, IKeybindingService, IKeybindingContext, IKeybindingService2, KbExpr} from 'vs/platform/keybinding/common/keybinding';
class MockKeybindingContextKey<T> implements IKeybindingContextKey<T> {
private _key: string;
@ -50,6 +50,16 @@ export class MockKeybindingService implements IKeybindingService {
public getContextValue(key: string) {
return;
}
public getContext(contextId: number): IKeybindingContext {
return null;
}
public createScoped(domNode: HTMLElement): IKeybindingService {
return this;
}
}
export class MockKeybindingService2 implements IKeybindingService2 {
public _serviceBrand: any;
public getLabelFor(keybinding: Keybinding): string {
return keybinding._toUSLabel();
@ -67,10 +77,6 @@ export class MockKeybindingService implements IKeybindingService {
return keybinding._toElectronAccelerator();
}
public createScoped(domNode: HTMLElement): IKeybindingService {
return this;
}
public getDefaultKeybindings(): string {
return null;
}

View file

@ -23,7 +23,7 @@ import {IEditorGroupService} from 'vs/workbench/services/group/common/groupServi
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {IFileService, IFileOperationResult, FileOperationResult} from 'vs/platform/files/common/files';
import {IMessageService, Severity, CloseAction} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
@ -47,7 +47,7 @@ export class BaseTwoEditorsAction extends Action {
@IConfigurationService protected configurationService: IConfigurationService,
@IMessageService protected messageService: IMessageService,
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
@IKeybindingService protected keybindingService: IKeybindingService,
@IKeybindingService2 protected keybindingService2: IKeybindingService2,
@IInstantiationService protected instantiationService: IInstantiationService
) {
super(id, label);
@ -96,10 +96,10 @@ export class BaseOpenSettingsAction extends BaseTwoEditorsAction {
@IConfigurationService configurationService: IConfigurationService,
@IMessageService messageService: IMessageService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService instantiationService: IInstantiationService
) {
super(id, label, editorService, editorGroupService, fileService, configurationService, messageService, contextService, keybindingService, instantiationService);
super(id, label, editorService, editorGroupService, fileService, configurationService, messageService, contextService, keybindingService2, instantiationService);
}
protected open(emptySettingsContents: string, settingsResource: URI): TPromise<void> {
@ -132,11 +132,11 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
@IConfigurationService configurationService: IConfigurationService,
@IMessageService messageService: IMessageService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService private storageService: IStorageService
) {
super(id, label, editorService, editorGroupService, fileService, configurationService, messageService, contextService, keybindingService, instantiationService);
super(id, label, editorService, editorGroupService, fileService, configurationService, messageService, contextService, keybindingService2, instantiationService);
}
public run(event?: any): TPromise<void> {
@ -184,16 +184,16 @@ export class OpenGlobalKeybindingsAction extends BaseTwoEditorsAction {
@IConfigurationService configurationService: IConfigurationService,
@IMessageService messageService: IMessageService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService instantiationService: IInstantiationService
) {
super(id, label, editorService, editorGroupService, fileService, configurationService, messageService, contextService, keybindingService, instantiationService);
super(id, label, editorService, editorGroupService, fileService, configurationService, messageService, contextService, keybindingService2, instantiationService);
}
public run(event?: any): TPromise<void> {
let emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]';
return this.openTwoEditors(DefaultKeybindingsInput.getInstance(this.instantiationService, this.keybindingService), URI.file(this.contextService.getConfiguration().env.appKeybindingsPath), emptyContents);
return this.openTwoEditors(DefaultKeybindingsInput.getInstance(this.instantiationService, this.keybindingService2), URI.file(this.contextService.getConfiguration().env.appKeybindingsPath), emptyContents);
}
}
@ -243,10 +243,10 @@ class DefaultSettingsInput extends StringEditorInput {
class DefaultKeybindingsInput extends StringEditorInput {
private static INSTANCE: DefaultKeybindingsInput;
public static getInstance(instantiationService: IInstantiationService, keybindingService: IKeybindingService): DefaultKeybindingsInput {
public static getInstance(instantiationService: IInstantiationService, keybindingService2: IKeybindingService2): DefaultKeybindingsInput {
if (!DefaultKeybindingsInput.INSTANCE) {
let defaultsHeader = '// ' + nls.localize('defaultKeybindingsHeader', "Overwrite key bindings by placing them into your key bindings file.");
let defaultContents = keybindingService.getDefaultKeybindings();
let defaultContents = keybindingService2.getDefaultKeybindings();
DefaultKeybindingsInput.INSTANCE = instantiationService.createInstance(DefaultKeybindingsInput, nls.localize('defaultKeybindings', "Default Keyboard Shortcuts"), null, defaultsHeader + '\n' + defaultContents, 'application/json', false);
}

View file

@ -25,7 +25,7 @@ import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
// import {Scope, IActionBarRegistry, Extensions as ActionBarExtensions, prepareActions} from 'vs/workbench/browser/actionBarRegistry';
// import Severity from 'vs/base/common/severity';
// import {IAction} from 'vs/base/common/actions';
@ -45,7 +45,7 @@ export class ActivitybarPart extends Part implements IActivityService {
@IMessageService private messageService: IMessageService,
@ITelemetryService private telemetryService: ITelemetryService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService2 private keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id);
@ -139,7 +139,7 @@ export class ActivitybarPart extends Part implements IActivityService {
let action = this.instantiationService.createInstance(ViewletActivityAction, viewlet.id + '.activity-bar-action', viewlet);
let keybinding: string = null;
let keys = this.keybindingService.lookupKeybindings(viewlet.id).map(k => this.keybindingService.getLabelFor(k));
let keys = this.keybindingService2.lookupKeybindings(viewlet.id).map(k => this.keybindingService2.getLabelFor(k));
if (keys && keys.length) {
keybinding = keys[0];
}

View file

@ -33,7 +33,7 @@ import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollect
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IProgressService} from 'vs/platform/progress/common/progress';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
export abstract class CompositePart<T extends Composite> extends Part {
private instantiatedCompositeListeners: IDisposable[];
@ -57,7 +57,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
private telemetryService: ITelemetryService,
private contextMenuService: IContextMenuService,
protected partService: IPartService,
private keybindingService: IKeybindingService,
private keybindingService2: IKeybindingService2,
protected instantiationService: IInstantiationService,
private registry: CompositeRegistry<T>,
private activeCompositeSettingsKey: string,
@ -330,7 +330,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
let keybinding: string = null;
let keys = this.keybindingService.lookupKeybindings(compositeId).map(k => this.keybindingService.getLabelFor(k));
let keys = this.keybindingService2.lookupKeybindings(compositeId).map(k => this.keybindingService2.getLabelFor(k));
if (keys && keys.length) {
keybinding = keys[0];
}
@ -419,7 +419,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
actionItemProvider: (action: Action) => this.actionItemProvider(action),
orientation: ActionsOrientation.HORIZONTAL,
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}

View file

@ -16,7 +16,7 @@ import {IPartService} from 'vs/workbench/services/part/common/partService';
import {Position, IEditor, Direction, IResourceInput, IEditorInput} from 'vs/platform/editor/common/editor';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IHistoryService} from 'vs/workbench/services/history/common/history';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IEditorGroupService, GroupArrangement} from 'vs/workbench/services/group/common/groupService';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import {ICommandService} from 'vs/platform/commands/common/commands';
@ -1024,7 +1024,7 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
id: string,
label: string,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService2 private keybindingService2: IKeybindingService2,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
@ -1032,7 +1032,7 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
}
public run(): TPromise<any> {
let keys = this.keybindingService.lookupKeybindings(this.id);
let keys = this.keybindingService2.lookupKeybindings(this.id);
const stacks = this.editorGroupService.getStacksModel();
if (stacks.activeGroup) {
@ -1062,11 +1062,11 @@ export class OpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEd
id: string,
label: string,
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService
) {
super(id, label, quickOpenService, keybindingService, editorGroupService, editorService);
super(id, label, quickOpenService, keybindingService2, editorGroupService, editorService);
}
}
@ -1079,11 +1079,11 @@ export class OpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditor
id: string,
label: string,
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService
) {
super(id, label, quickOpenService, keybindingService, editorGroupService, editorService);
super(id, label, quickOpenService, keybindingService2, editorGroupService, editorService);
}
}
@ -1115,13 +1115,13 @@ export class OpenPreviousEditorFromHistoryAction extends Action {
id: string,
label: string,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService2 private keybindingService2: IKeybindingService2
) {
super(id, label);
}
public run(): TPromise<any> {
let keys = this.keybindingService.lookupKeybindings(this.id);
let keys = this.keybindingService2.lookupKeybindings(this.id);
this.quickOpenService.show(null, { quickNavigateConfiguration: { keybindings: keys } });
@ -1195,7 +1195,7 @@ export class BaseQuickOpenNavigateAction extends Action {
label: string,
navigateNext: boolean,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService2 private keybindingService2: IKeybindingService2
) {
super(id, label);
@ -1203,7 +1203,7 @@ export class BaseQuickOpenNavigateAction extends Action {
}
public run(event?: any): TPromise<any> {
let keys = this.keybindingService.lookupKeybindings(this.id);
let keys = this.keybindingService2.lookupKeybindings(this.id);
this.quickOpenService.quickNavigate({
keybindings: keys
@ -1222,9 +1222,9 @@ export class QuickOpenNavigateNextAction extends BaseQuickOpenNavigateAction {
id: string,
label: string,
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService2 keybindingService2: IKeybindingService2
) {
super(id, label, true, quickOpenService, keybindingService);
super(id, label, true, quickOpenService, keybindingService2);
}
}
@ -1237,9 +1237,9 @@ export class QuickOpenNavigatePreviousAction extends BaseQuickOpenNavigateAction
id: string,
label: string,
@IQuickOpenService quickOpenService: IQuickOpenService,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService2 keybindingService2: IKeybindingService2
) {
super(id, label, false, quickOpenService, keybindingService);
super(id, label, false, quickOpenService, keybindingService2);
}
}

View file

@ -24,7 +24,7 @@ import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/unti
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IMenuService} from 'vs/platform/actions/common/actions';
import {TitleControl} from 'vs/workbench/browser/parts/editor/titleControl';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
@ -48,12 +48,13 @@ export class TabsTitleControl extends TitleControl {
@IEditorGroupService editorGroupService: IEditorGroupService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@ITelemetryService telemetryService: ITelemetryService,
@IMessageService messageService: IMessageService,
@IMenuService menuService: IMenuService,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(contextMenuService, instantiationService, configurationService, editorService, editorGroupService, keybindingService, telemetryService, messageService, menuService, quickOpenService);
super(contextMenuService, instantiationService, configurationService, editorService, editorGroupService, keybindingService, keybindingService2, telemetryService, messageService, menuService, quickOpenService);
this.tabDisposeables = [];
}

View file

@ -29,7 +29,7 @@ import {StandardMouseEvent} from 'vs/base/browser/mouseEvent';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {CloseEditorsInGroupAction, SplitEditorAction, CloseEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, CloseRightEditorsInGroupAction, ShowEditorsInGroupAction} from 'vs/workbench/browser/parts/editor/editorActions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {createActionItem, fillInActions} from 'vs/platform/actions/browser/menuItemActionItem';
@ -95,6 +95,7 @@ export abstract class TitleControl implements ITitleAreaControl {
@IWorkbenchEditorService protected editorService: IWorkbenchEditorService,
@IEditorGroupService protected editorGroupService: IEditorGroupService,
@IKeybindingService protected keybindingService: IKeybindingService,
@IKeybindingService2 protected keybindingService2: IKeybindingService2,
@ITelemetryService protected telemetryService: ITelemetryService,
@IMessageService protected messageService: IMessageService,
@IMenuService protected menuService: IMenuService,
@ -234,7 +235,7 @@ export abstract class TitleControl implements ITitleAreaControl {
orientation: ActionsOrientation.HORIZONTAL,
ariaLabel: nls.localize('araLabelEditorActions', "Editor actions"),
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}
@ -282,7 +283,7 @@ export abstract class TitleControl implements ITitleAreaControl {
// Check extensions
if (!actionItem) {
actionItem = createActionItem(action, this.keybindingService, this.messageService);
actionItem = createActionItem(action, this.keybindingService2, this.messageService);
}
return actionItem;
@ -414,7 +415,7 @@ export abstract class TitleControl implements ITitleAreaControl {
getActions: () => TPromise.as(this.getContextMenuActions(identifier)),
getActionsContext: () => identifier,
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}

View file

@ -25,7 +25,7 @@ import {IStorageService} from 'vs/platform/storage/common/storage';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
@ -46,7 +46,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
@ITelemetryService telemetryService: ITelemetryService,
@IContextMenuService contextMenuService: IContextMenuService,
@IPartService partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService instantiationService: IInstantiationService
) {
super(
@ -55,7 +55,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
telemetryService,
contextMenuService,
partService,
keybindingService,
keybindingService2,
instantiationService,
(<PanelRegistry>Registry.as(PanelExtensions.Panels)),
PanelPart.activePanelSettingsKey,

View file

@ -21,7 +21,7 @@ import {IStorageService} from 'vs/platform/storage/common/storage';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import Event, {Emitter} from 'vs/base/common/event';
@ -43,7 +43,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
@ITelemetryService telemetryService: ITelemetryService,
@IContextMenuService contextMenuService: IContextMenuService,
@IPartService partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService instantiationService: IInstantiationService
) {
super(
@ -52,7 +52,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
telemetryService,
contextMenuService,
partService,
keybindingService,
keybindingService2,
instantiationService,
(<ViewletRegistry>Registry.as(ViewletExtensions.Viewlets)),
SidebarPart.activeViewletSettingsKey,

View file

@ -23,7 +23,7 @@ import {IViewlet} from 'vs/workbench/common/viewlet';
import {Composite, CompositeDescriptor, CompositeRegistry} from 'vs/workbench/browser/composite';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
export abstract class Viewlet extends Composite implements IViewlet {
@ -305,7 +305,7 @@ export abstract class AdaptiveCollapsibleViewletView extends FixedCollapsibleVie
collapsed: boolean,
private viewName: string,
private messageService: IMessageService,
private keybindingService: IKeybindingService,
private keybindingService2: IKeybindingService2,
protected contextMenuService: IContextMenuService
) {
super({
@ -331,7 +331,7 @@ export abstract class AdaptiveCollapsibleViewletView extends FixedCollapsibleVie
actionItemProvider: (action) => { return this.getActionItem(action); },
ariaLabel: nls.localize('viewToolbarAriaLabel', "{0} actions", this.viewName),
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}
@ -434,7 +434,7 @@ export abstract class CollapsibleViewletView extends CollapsibleView implements
collapsed: boolean,
private viewName: string,
protected messageService: IMessageService,
private keybindingService: IKeybindingService,
private keybindingService2: IKeybindingService2,
protected contextMenuService: IContextMenuService,
headerSize?: number
) {
@ -467,7 +467,7 @@ export abstract class CollapsibleViewletView extends CollapsibleView implements
actionItemProvider: (action) => { return this.getActionItem(action); },
ariaLabel: nls.localize('viewToolbarAriaLabel', "{0} actions", this.viewName),
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}

View file

@ -18,7 +18,7 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {ICommandService} from 'vs/platform/commands/common/commands';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IWorkspaceContextService}from 'vs/workbench/services/workspace/common/contextService';
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
@ -51,7 +51,7 @@ export class ElectronIntegration {
@ITelemetryService private telemetryService: ITelemetryService,
@IConfigurationService private configurationService: IConfigurationService,
@ICommandService private commandService: ICommandService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService2 private keybindingService2: IKeybindingService2,
@IMessageService private messageService: IMessageService,
@IContextMenuService private contextMenuService: IContextMenuService
) {
@ -156,7 +156,7 @@ export class ElectronIntegration {
getAnchor: () => target,
getActions: () => TPromise.as(TextInputActions),
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}
@ -172,12 +172,12 @@ export class ElectronIntegration {
private resolveKeybindings(actionIds: string[]): TPromise<{ id: string; binding: number; }[]> {
return this.partService.joinCreation().then(() => {
return arrays.coalesce(actionIds.map((id) => {
let bindings = this.keybindingService.lookupKeybindings(id);
let bindings = this.keybindingService2.lookupKeybindings(id);
// return the first binding that can be represented by electron
for (let i = 0; i < bindings.length; i++) {
let binding = bindings[i];
let electronAccelerator = this.keybindingService.getElectronAcceleratorFor(binding);
let electronAccelerator = this.keybindingService2.getElectronAcceleratorFor(binding);
if (electronAccelerator) {
return {
id: id,

View file

@ -104,6 +104,7 @@ export class Workbench implements IPartService {
private workbenchShutdown: boolean;
private editorService: WorkbenchEditorService;
private keybindingService: IKeybindingService;
private keybindingService2: IKeybindingService2;
private activitybarPart: ActivitybarPart;
private sidebarPart: SidebarPart;
private panelPart: PanelPart;
@ -272,7 +273,7 @@ export class Workbench implements IPartService {
this.creationPromiseComplete(true);
if (this.callbacks && this.callbacks.onWorkbenchStarted) {
this.callbacks.onWorkbenchStarted(this.keybindingService.customKeybindingsCount());
this.callbacks.onWorkbenchStarted(this.keybindingService2.customKeybindingsCount());
}
if (error) {
@ -350,10 +351,11 @@ export class Workbench implements IPartService {
serviceCollection.set(IStatusbarService, this.statusbarPart);
// Keybindings
this.keybindingService = this.instantiationService.createInstance(WorkbenchKeybindingService, <any>window);
this.keybindingService = this.instantiationService.createInstance(WorkbenchKeybindingService);
serviceCollection.set(IKeybindingService, this.keybindingService);
serviceCollection.set(IKeybindingService2, this.instantiationService.createInstance(WorkbenchKeybindingService2));
this.keybindingService2 = this.instantiationService.createInstance(WorkbenchKeybindingService2, <any>window);
serviceCollection.set(IKeybindingService2, this.keybindingService2);
// Context Menu
serviceCollection.set(IContextMenuService, this.instantiationService.createInstance(ContextMenuService));

View file

@ -10,7 +10,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
import {Range} from 'vs/editor/common/core/range';
import editorCommon = require('vs/editor/common/editorCommon');
import editorbrowser = require('vs/editor/browser/editorBrowser');
import {KbExpr, IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {KbExpr, IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {ICommandService} from 'vs/platform/commands/common/commands';
import debug = require('vs/workbench/parts/debug/common/debug');
import model = require('vs/workbench/parts/debug/common/debugModel');
@ -32,14 +32,14 @@ export class AbstractDebugAction extends actions.Action {
constructor(
id: string, label: string, cssClass: string,
@IDebugService protected debugService: IDebugService,
@IKeybindingService protected keybindingService: IKeybindingService
@IKeybindingService2 protected keybindingService2: IKeybindingService2
) {
super(id, label, cssClass, false);
this.debugService = debugService;
this.toDispose = [];
this.toDispose.push(this.debugService.onDidChangeState((state) => this.updateEnablement(state)));
const keys = this.keybindingService.lookupKeybindings(id).map(k => this.keybindingService.getLabelFor(k));
const keys = this.keybindingService2.lookupKeybindings(id).map(k => this.keybindingService2.getLabelFor(k));
if (keys && keys.length) {
this.keybinding = keys[0];
}
@ -80,8 +80,8 @@ export class ConfigureAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.configure';
static LABEL = nls.localize('openLaunchJson', "Open {0}", 'launch.json');
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action configure', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action configure', debugService, keybindingService2);
this.toDispose.push(debugService.getConfigurationManager().onDidConfigurationChange((configurationName) => {
if (configurationName) {
this.class = 'debug-action configure';
@ -103,8 +103,8 @@ export class SelectConfigAction extends AbstractDebugAction {
static ID = 'workbench.debug.action.setActiveConfig';
static LABEL = nls.localize('selectConfig', "Select Configuration");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action select-active-config', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action select-active-config', debugService, keybindingService2);
}
public run(configName: string): TPromise<any> {
@ -120,8 +120,8 @@ export class StartDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.start';
static LABEL = nls.localize('startDebug', "Start Debugging");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService, @ICommandService private commandService: ICommandService) {
super(id, label, 'debug-action start', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2, @ICommandService private commandService: ICommandService) {
super(id, label, 'debug-action start', debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -138,8 +138,8 @@ export class RestartDebugAction extends AbstractDebugAction {
static LABEL = nls.localize('restartDebug', "Restart");
static RECONNECT_LABEL = nls.localize('reconnectDebug', "Reconnect");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action restart', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action restart', debugService, keybindingService2);
this.toDispose.push(this.debugService.onDidChangeState(() => {
const session = this.debugService.getActiveSession();
if (session) {
@ -161,8 +161,8 @@ export class StepOverDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.stepOver';
static LABEL = nls.localize('stepOverDebug', "Step Over");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-over', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action step-over', debugService, keybindingService2);
}
public run(thread: debug.IThread): TPromise<any> {
@ -181,8 +181,8 @@ export class StepIntoDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.stepInto';
static LABEL = nls.localize('stepIntoDebug', "Step Into");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-into', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action step-into', debugService, keybindingService2);
}
public run(thread: debug.IThread): TPromise<any> {
@ -201,8 +201,8 @@ export class StepOutDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.stepOut';
static LABEL = nls.localize('stepOutDebug', "Step Out");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-out', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action step-out', debugService, keybindingService2);
}
public run(thread: debug.IThread): TPromise<any> {
@ -221,8 +221,8 @@ export class StepBackDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.stepBack';
static LABEL = nls.localize('stepBackDebug', "Step Back");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-back', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action step-back', debugService, keybindingService2);
}
public run(thread: debug.IThread): TPromise<any> {
@ -244,8 +244,8 @@ export class StopDebugAction extends AbstractDebugAction {
static LABEL = nls.localize('stopDebug', "Stop");
static DISCONNECT_LABEL = nls.localize('disconnectDebug', "Disconnect");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action stop', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action stop', debugService, keybindingService2);
this.toDispose.push(this.debugService.onDidChangeState(() => {
const session = this.debugService.getActiveSession();
if (session) {
@ -268,8 +268,8 @@ export class ContinueAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.continue';
static LABEL = nls.localize('continueDebug', "Continue");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action continue', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action continue', debugService, keybindingService2);
}
public run(thread: debug.IThread): TPromise<any> {
@ -288,8 +288,8 @@ export class PauseAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.pause';
static LABEL = nls.localize('pauseDebug', "Pause");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action pause', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action pause', debugService, keybindingService2);
}
public run(thread: debug.IThread): TPromise<any> {
@ -308,8 +308,8 @@ export class RestartFrameAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.restartFrame';
static LABEL = nls.localize('restartFrame', "Restart Frame");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action restart-frame', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action restart-frame', debugService, keybindingService2);
}
public run(frame: debug.IStackFrame): TPromise<any> {
@ -326,8 +326,8 @@ export class RemoveBreakpointAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.removeBreakpoint';
static LABEL = nls.localize('removeBreakpoint', "Remove Breakpoint");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action remove', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action remove', debugService, keybindingService2);
}
public run(breakpoint: debug.IBreakpoint): TPromise<any> {
@ -340,8 +340,8 @@ export class RemoveAllBreakpointsAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.removeAllBreakpoints';
static LABEL = nls.localize('removeAllBreakpoints', "Remove All Breakpoints");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action remove-all', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action remove-all', debugService, keybindingService2);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => this.updateEnablement(this.debugService.state)));
}
@ -359,8 +359,8 @@ export class ToggleEnablementAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.toggleBreakpointEnablement';
static LABEL = nls.localize('toggleEnablement', "Enable/Disable Breakpoint");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action toggle-enablement', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action toggle-enablement', debugService, keybindingService2);
}
public run(element: debug.IEnablement): TPromise<any> {
@ -372,8 +372,8 @@ export class EnableAllBreakpointsAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.enableAllBreakpoints';
static LABEL = nls.localize('enableAllBreakpoints', "Enable All Breakpoints");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action enable-all-breakpoints', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action enable-all-breakpoints', debugService, keybindingService2);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => this.updateEnablement(this.debugService.state)));
}
@ -391,8 +391,8 @@ export class DisableAllBreakpointsAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.disableAllBreakpoints';
static LABEL = nls.localize('disableAllBreakpoints', "Disable All Breakpoints");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action disable-all-breakpoints', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action disable-all-breakpoints', debugService, keybindingService2);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => this.updateEnablement(this.debugService.state)));
}
@ -411,8 +411,8 @@ export class ToggleBreakpointsActivatedAction extends AbstractDebugAction {
static ACTIVATE_LABEL = nls.localize('activateBreakpoints', "Activate Breakpoints");
static DEACTIVATE_LABEL = nls.localize('deactivateBreakpoints', "Deactivate Breakpoints");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action breakpoints-activate', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action breakpoints-activate', debugService, keybindingService2);
this.updateLabel(this.debugService.getModel().areBreakpointsActivated() ? ToggleBreakpointsActivatedAction.DEACTIVATE_LABEL : ToggleBreakpointsActivatedAction.ACTIVATE_LABEL);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => {
@ -434,8 +434,8 @@ export class ReapplyBreakpointsAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.reapplyBreakpointsAction';
static LABEL = nls.localize('reapplyAllBreakpoints', "Reapply All Breakpoints");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, null, debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, null, debugService, keybindingService2);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => this.updateEnablement(this.debugService.state)));
}
@ -454,8 +454,8 @@ export class AddFunctionBreakpointAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.addFunctionBreakpointAction';
static LABEL = nls.localize('addFunctionBreakpoint', "Add Function Breakpoint");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action add-function-breakpoint', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action add-function-breakpoint', debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -468,8 +468,8 @@ export class RenameFunctionBreakpointAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.renameFunctionBreakpointAction';
static LABEL = nls.localize('renameFunctionBreakpoint', "Rename Function Breakpoint");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, null, debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, null, debugService, keybindingService2);
}
public run(fbp: debug.IFunctionBreakpoint): TPromise<any> {
@ -486,10 +486,10 @@ export class AddConditionalBreakpointAction extends AbstractDebugAction {
private editor: editorbrowser.ICodeEditor,
private lineNumber: number,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id, label, null, debugService, keybindingService);
super(id, label, null, debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -506,10 +506,10 @@ export class EditConditionalBreakpointAction extends AbstractDebugAction {
private editor: editorbrowser.ICodeEditor,
private lineNumber: number,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id, label, null, debugService, keybindingService);
super(id, label, null, debugService, keybindingService2);
}
public run(breakpoint: debug.IBreakpoint): TPromise<any> {
@ -573,8 +573,8 @@ export class SetValueAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.setValue';
static LABEL = nls.localize('setValue', "Set Value");
constructor(id: string, label: string, private variable: model.Variable, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, null, debugService, keybindingService);
constructor(id: string, label: string, private variable: model.Variable, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, null, debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -636,8 +636,8 @@ export class AddWatchExpressionAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.addWatchExpression';
static LABEL = nls.localize('addWatchExpression', "Add Expression");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action add-watch-expression', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action add-watch-expression', debugService, keybindingService2);
this.toDispose.push(this.debugService.getModel().onDidChangeWatchExpressions(() => this.updateEnablement(this.debugService.state)));
}
@ -707,8 +707,8 @@ export class AddToWatchExpressionsAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.addToWatchExpressions';
static LABEL = nls.localize('addToWatchExpressions', "Add to Watch");
constructor(id: string, label: string, private expression: debug.IExpression, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action add-to-watch', debugService, keybindingService);
constructor(id: string, label: string, private expression: debug.IExpression, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action add-to-watch', debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -720,8 +720,8 @@ export class RenameWatchExpressionAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.renameWatchExpression';
static LABEL = nls.localize('renameWatchExpression', "Rename Expression");
constructor(id: string, label: string, private expression: model.Expression, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action rename', debugService, keybindingService);
constructor(id: string, label: string, private expression: model.Expression, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action rename', debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -734,8 +734,8 @@ export class RemoveWatchExpressionAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.removeWatchExpression';
static LABEL = nls.localize('removeWatchExpression', "Remove Expression");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action remove', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action remove', debugService, keybindingService2);
}
public run(expression: model.Expression): TPromise<any> {
@ -748,8 +748,8 @@ export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.removeAllWatchExpressions';
static LABEL = nls.localize('removeAllWatchExpressions', "Remove All Expressions");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action remove-all', debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, 'debug-action remove-all', debugService, keybindingService2);
this.toDispose.push(this.debugService.getModel().onDidChangeWatchExpressions(() => this.updateEnablement(this.debugService.state)));
}
@ -769,10 +769,10 @@ export class ClearReplAction extends AbstractDebugAction {
constructor(id: string, label: string,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IPanelService private panelService: IPanelService
) {
super(id, label, 'debug-action clear-repl', debugService, keybindingService);
super(id, label, 'debug-action clear-repl', debugService, keybindingService2);
}
public run(): TPromise<any> {
@ -791,9 +791,9 @@ export class ToggleReplAction extends AbstractDebugAction {
@IDebugService debugService: IDebugService,
@IPartService private partService: IPartService,
@IPanelService private panelService: IPanelService,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService2 keybindingService2: IKeybindingService2
) {
super(id, label, 'debug-action toggle-repl', debugService, keybindingService);
super(id, label, 'debug-action toggle-repl', debugService, keybindingService2);
this.enabled = this.debugService.state !== debug.State.Disabled;
this.registerListeners();
}
@ -832,8 +832,8 @@ export class RunAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.run';
static LABEL = nls.localize('startWithoutDebugging', "Start Without Debugging");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, null, debugService, keybindingService);
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService2 keybindingService2: IKeybindingService2) {
super(id, label, null, debugService, keybindingService2);
}
public run(): TPromise<any> {

View file

@ -24,7 +24,7 @@ import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IMessageService} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import IDebugService = debug.IDebugService;
@ -56,10 +56,10 @@ export class VariablesView extends viewlet.CollapsibleViewletView {
@IContextMenuService contextMenuService: IContextMenuService,
@ITelemetryService private telemetryService: ITelemetryService,
@IDebugService private debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, !!settings[VariablesView.MEMENTO], nls.localize('variablesSection', "Variables Section"), messageService, keybindingService, contextMenuService);
super(actionRunner, !!settings[VariablesView.MEMENTO], nls.localize('variablesSection', "Variables Section"), messageService, keybindingService2, contextMenuService);
}
public renderHeader(container: HTMLElement): void {
@ -145,10 +145,10 @@ export class WatchExpressionsView extends viewlet.CollapsibleViewletView {
@IMessageService messageService: IMessageService,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, !!settings[WatchExpressionsView.MEMENTO], nls.localize('expressionsSection', "Expressions Section"), messageService, keybindingService, contextMenuService);
super(actionRunner, !!settings[WatchExpressionsView.MEMENTO], nls.localize('expressionsSection', "Expressions Section"), messageService, keybindingService2, contextMenuService);
this.toDispose.push(this.debugService.getModel().onDidChangeWatchExpressions(we => {
// only expand when a new watch expression is added.
if (we instanceof Expression) {
@ -225,10 +225,10 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
@IContextMenuService contextMenuService: IContextMenuService,
@ITelemetryService private telemetryService: ITelemetryService,
@IDebugService private debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, !!settings[CallStackView.MEMENTO], nls.localize('callstackSection', "Call Stack Section"), messageService, keybindingService, contextMenuService);
super(actionRunner, !!settings[CallStackView.MEMENTO], nls.localize('callstackSection', "Call Stack Section"), messageService, keybindingService2, contextMenuService);
}
public renderHeader(container: HTMLElement): void {
@ -319,12 +319,12 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
@IMessageService messageService: IMessageService,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, BreakpointsView.getExpandedBodySize(
debugService.getModel().getBreakpoints().length + debugService.getModel().getFunctionBreakpoints().length + debugService.getModel().getExceptionBreakpoints().length),
!!settings[BreakpointsView.MEMENTO], nls.localize('breakpointsSection', "Breakpoints Section"), messageService, keybindingService, contextMenuService);
!!settings[BreakpointsView.MEMENTO], nls.localize('breakpointsSection', "Breakpoints Section"), messageService, keybindingService2, contextMenuService);
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(() => this.onBreakpointsChange()));
}

View file

@ -14,7 +14,7 @@ import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IWorkbenchActionRegistry, Extensions as ActionExtensions} from 'vs/workbench/common/actionRegistry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {FileStat} from 'vs/workbench/parts/files/common/explorerViewModel';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
@ -23,7 +23,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
constructor(
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService2 private keybindingService2: IKeybindingService2
) {
super();
}
@ -123,7 +123,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
// Any other item with keybinding
let keybinding = keybindingForAction(action.id);
if (keybinding) {
return new ActionItem(context, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) });
return new ActionItem(context, action, { label: true, keybinding: this.keybindingService2.getLabelFor(keybinding) });
}
}

View file

@ -33,7 +33,7 @@ import {IWorkspace} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IProgressService} from 'vs/platform/progress/common/progress';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
@ -83,10 +83,10 @@ export class ExplorerView extends CollapsibleViewletView {
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IFileService private fileService: IFileService,
@IPartService private partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IConfigurationService private configurationService: IConfigurationService
) {
super(actionRunner, false, nls.localize('explorerSection', "Files Explorer Section"), messageService, keybindingService, contextMenuService, headerSize);
super(actionRunner, false, nls.localize('explorerSection', "Files Explorer Section"), messageService, keybindingService2, contextMenuService, headerSize);
this.workspace = contextService.getWorkspace();

View file

@ -16,7 +16,7 @@ import {IMessageService} from 'vs/platform/message/common/message';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IEditorStacksModel, IStacksModelChangeEvent, IEditorGroup} from 'vs/workbench/common/editor';
import {SaveAllAction} from 'vs/workbench/parts/files/browser/fileActions';
import {AdaptiveCollapsibleViewletView} from 'vs/workbench/browser/viewlet';
@ -52,11 +52,11 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView {
@ITextFileService private textFileService: ITextFileService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IConfigurationService private configurationService: IConfigurationService,
@IKeybindingService keybindingService: IKeybindingService,
@IKeybindingService2 keybindingService2: IKeybindingService2,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IViewletService private viewletService: IViewletService
) {
super(actionRunner, OpenEditorsView.computeExpandedBodySize(editorGroupService.getStacksModel()), !!settings[OpenEditorsView.MEMENTO_COLLAPSED], nls.localize('openEditosrSection', "Open Editors Section"), messageService, keybindingService, contextMenuService);
super(actionRunner, OpenEditorsView.computeExpandedBodySize(editorGroupService.getStacksModel()), !!settings[OpenEditorsView.MEMENTO_COLLAPSED], nls.localize('openEditosrSection', "Open Editors Section"), messageService, keybindingService2, contextMenuService);
this.settings = settings;
this.model = editorGroupService.getStacksModel();

View file

@ -20,7 +20,7 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {UntitledEditorInput, IEditorGroup, IEditorStacksModel} from 'vs/workbench/common/editor';
import {ContributableActionProvider} from 'vs/workbench/browser/actionBarRegistry';
import {ITextFileService, AutoSaveMode, FileEditorInput, asFileResource} from 'vs/workbench/parts/files/common/files';
@ -208,7 +208,7 @@ export class Controller extends treedefaults.DefaultController {
@IInstantiationService private instantiationService: IInstantiationService,
@IContextMenuService private contextMenuService: IContextMenuService,
@ITelemetryService private telemetryService: ITelemetryService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService2 private keybindingService2: IKeybindingService2
) {
super({ clickBehavior: treedefaults.ClickBehavior.ON_MOUSE_DOWN });
}
@ -315,7 +315,7 @@ export class Controller extends treedefaults.DefaultController {
getAnchor: () => anchor,
getActions: () => this.actionProvider.getSecondaryActions(tree, element),
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}

View file

@ -25,7 +25,7 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService, Severity, IMessageWithAction} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
export const ALL_COMMANDS_PREFIX = '>';
@ -243,7 +243,7 @@ export class CommandsHandler extends QuickOpenHandler {
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
@IMessageService private messageService: IMessageService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService2 private keybindingService2: IKeybindingService2,
@IMenuService private menuService: IMenuService
) {
super();
@ -302,9 +302,9 @@ export class CommandsHandler extends QuickOpenHandler {
for (let i = 0; i < actionDescriptors.length; i++) {
let actionDescriptor = actionDescriptors[i];
let keys = this.keybindingService.lookupKeybindings(actionDescriptor.id);
let keyLabel = keys.map(k => this.keybindingService.getLabelFor(k));
let keyAriaLabel = keys.map(k => this.keybindingService.getAriaLabelFor(k));
let keys = this.keybindingService2.lookupKeybindings(actionDescriptor.id);
let keyLabel = keys.map(k => this.keybindingService2.getLabelFor(k));
let keyAriaLabel = keys.map(k => this.keybindingService2.getAriaLabelFor(k));
if (actionDescriptor.label) {
@ -334,9 +334,9 @@ export class CommandsHandler extends QuickOpenHandler {
for (let i = 0; i < actions.length; i++) {
let action = actions[i];
let keys = this.keybindingService.lookupKeybindings(action.id);
let keyLabel = keys.map(k => this.keybindingService.getLabelFor(k));
let keyAriaLabel = keys.map(k => this.keybindingService.getAriaLabelFor(k));
let keys = this.keybindingService2.lookupKeybindings(action.id);
let keyLabel = keys.map(k => this.keybindingService2.getLabelFor(k));
let keyAriaLabel = keys.map(k => this.keybindingService2.getAriaLabelFor(k));
let label = action.label;
if (label) {
@ -358,9 +358,9 @@ export class CommandsHandler extends QuickOpenHandler {
let entries: ActionCommandEntry[] = [];
for (let action of actions) {
let keys = this.keybindingService.lookupKeybindings(action.id);
let keyLabel = keys.map(k => this.keybindingService.getLabelFor(k));
let keyAriaLabel = keys.map(k => this.keybindingService.getAriaLabelFor(k));
let keys = this.keybindingService2.lookupKeybindings(action.id);
let keyLabel = keys.map(k => this.keybindingService2.getLabelFor(k));
let keyAriaLabel = keys.map(k => this.keybindingService2.getAriaLabelFor(k));
let highlights = wordFilter(searchValue, action.label);
if (highlights) {
entries.push(this.instantiationService.createInstance(ActionCommandEntry, keyLabel.join(', '), keyAriaLabel.join(', '), action.label, null, highlights, null, action));

View file

@ -22,7 +22,7 @@ import { OpenGlobalSettingsAction } from 'vs/workbench/browser/actions/openSetti
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Keybinding, KeyCode, KeyMod, CommonKeybindings } from 'vs/base/common/keyCodes';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IKeybindingService2 } from 'vs/platform/keybinding/common/keybinding';
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
export function isSearchViewletFocussed(viewletService: IViewletService):boolean {
@ -31,11 +31,11 @@ export function isSearchViewletFocussed(viewletService: IViewletService):boolean
return activeViewlet && activeViewlet.getId() === Constants.VIEWLET_ID && activeElement && DOM.isAncestor(activeElement, (<SearchViewlet>activeViewlet).getContainer().getHTMLElement());
}
export function appendKeyBindingLabel(label: string, keyBinding: Keybinding, keyBindingService: IKeybindingService):string
export function appendKeyBindingLabel(label: string, keyBinding: number, keyBindingService: IKeybindingService):string
export function appendKeyBindingLabel(label: string, keyBinding: any, keyBindingService: IKeybindingService):string {
export function appendKeyBindingLabel(label: string, keyBinding: Keybinding, keyBindingService2: IKeybindingService2):string
export function appendKeyBindingLabel(label: string, keyBinding: number, keyBindingService2: IKeybindingService2):string
export function appendKeyBindingLabel(label: string, keyBinding: any, keyBindingService2: IKeybindingService2):string {
keyBinding= typeof keyBinding === 'number' ? new Keybinding(keyBinding) : keyBinding;
return label + ' (' + keyBindingService.getLabelFor(keyBinding) + ')';
return label + ' (' + keyBindingService2.getLabelFor(keyBinding) + ')';
}
export class OpenSearchViewletAction extends ToggleViewletAction {
@ -191,9 +191,9 @@ export class ReplaceAllAction extends AbstractSearchAndReplaceAction {
constructor(private viewer: ITree, private fileMatch: FileMatch, private viewlet: SearchViewlet,
@IReplaceService private replaceService: IReplaceService,
@IKeybindingService keyBindingService: IKeybindingService,
@IKeybindingService2 keyBindingService2: IKeybindingService2,
@ITelemetryService private telemetryService: ITelemetryService) {
super('file-action-replace-all', appendKeyBindingLabel(nls.localize('file.replaceAll.label', "Replace All"), ReplaceAllAction.KEY_BINDING, keyBindingService), 'action-replace-all');
super('file-action-replace-all', appendKeyBindingLabel(nls.localize('file.replaceAll.label', "Replace All"), ReplaceAllAction.KEY_BINDING, keyBindingService2), 'action-replace-all');
}
public run(): TPromise<any> {
@ -217,10 +217,10 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction {
constructor(private viewer: ITree, private element: Match, private viewlet: SearchViewlet,
@IReplaceService private replaceService: IReplaceService,
@IKeybindingService keyBindingService: IKeybindingService,
@IKeybindingService2 keyBindingService2: IKeybindingService2,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@ITelemetryService private telemetryService: ITelemetryService) {
super('action-replace', appendKeyBindingLabel(nls.localize('match.replace.label', "Replace"), ReplaceAction.KEY_BINDING, keyBindingService), 'action-replace');
super('action-replace', appendKeyBindingLabel(nls.localize('match.replace.label', "Replace"), ReplaceAction.KEY_BINDING, keyBindingService2), 'action-replace');
}
public run(): TPromise<any> {

View file

@ -45,7 +45,7 @@ import {IMessageService} from 'vs/platform/message/common/message';
import {ISearchService} from 'vs/platform/search/common/search';
import {IProgressService} from 'vs/platform/progress/common/progress';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingService2, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybinding';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {KeyCode, CommonKeybindings} from 'vs/base/common/keyCodes';
import { PatternInputWidget } from 'vs/workbench/parts/search/browser/patternInputWidget';
@ -100,6 +100,7 @@ export class SearchViewlet extends Viewlet {
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ISearchService private searchService: ISearchService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService2 private keybindingService2: IKeybindingService2,
@IReplaceService private replaceService: IReplaceService
) {
super(VIEWLET_ID, telemetryService);
@ -267,7 +268,7 @@ export class SearchViewlet extends Viewlet {
isRegex: isRegex,
isCaseSensitive: isCaseSensitive,
isWholeWords: isWholeWords
}, this.keybindingService, this.instantiationService);
}, this.keybindingService, this.keybindingService2, this.instantiationService);
if (this.storageService.getBoolean(SearchViewlet.SHOW_REPLACE_STORAGE_KEY, StorageScope.WORKSPACE, true)) {
this.searchWidget.toggleReplace(true);

View file

@ -15,7 +15,7 @@ import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { Button } from 'vs/base/browser/ui/button/button';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { KbExpr, KbCtxKey, IKeybindingService, IKeybindingContextKey } from 'vs/platform/keybinding/common/keybinding';
import { KbExpr, KbCtxKey, IKeybindingService, IKeybindingService2, IKeybindingContextKey } from 'vs/platform/keybinding/common/keybinding';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import Event, { Emitter } from 'vs/base/common/event';
@ -66,9 +66,9 @@ export class SearchWidget extends Widget {
static REPLACE_ACTIVE_CONTEXT_KEY= new KbCtxKey<boolean>('replaceActive', false);
private static REPLACE_ALL_DISABLED_LABEL= nls.localize('search.action.replaceAll.disabled.label', "Replace All (Submit Search to Enable)");
private static REPLACE_ALL_ENABLED_LABEL=(keyBindingService: IKeybindingService):string=>{
let keybindings = keyBindingService.lookupKeybindings(ReplaceAllAction.ID);
return appendKeyBindingLabel(nls.localize('search.action.replaceAll.enabled.label', "Replace All"), keybindings[0], keyBindingService);
private static REPLACE_ALL_ENABLED_LABEL=(keyBindingService2: IKeybindingService2):string=>{
let keybindings = keyBindingService2.lookupKeybindings(ReplaceAllAction.ID);
return appendKeyBindingLabel(nls.localize('search.action.replaceAll.enabled.label', "Replace All"), keybindings[0], keyBindingService2);
};
public domNode: HTMLElement;
@ -103,7 +103,7 @@ export class SearchWidget extends Widget {
public onReplaceAll: Event<void> = this._onReplaceAll.event;
constructor(container: Builder, private contextViewService: IContextViewService, options: ISearchWidgetOptions= Object.create(null),
private keyBindingService: IKeybindingService, private instantiationService: IInstantiationService) {
private keyBindingService: IKeybindingService, private keyBindingService2: IKeybindingService2, private instantiationService: IInstantiationService) {
super();
this.replaceActive = SearchWidget.REPLACE_ACTIVE_CONTEXT_KEY.bindTo(this.keyBindingService);
this.render(container, options);
@ -220,7 +220,7 @@ export class SearchWidget extends Widget {
public setReplaceAllActionState(enabled:boolean):void {
if (this.replaceAllAction.enabled !== enabled) {
this.replaceAllAction.enabled= enabled;
this.replaceAllAction.label= enabled ? SearchWidget.REPLACE_ALL_ENABLED_LABEL(this.keyBindingService) : SearchWidget.REPLACE_ALL_DISABLED_LABEL;
this.replaceAllAction.label= enabled ? SearchWidget.REPLACE_ALL_ENABLED_LABEL(this.keyBindingService2) : SearchWidget.REPLACE_ALL_DISABLED_LABEL;
this.updateReplaceActiveState();
}
}

View file

@ -11,7 +11,7 @@ import xterm = require('xterm');
import {Dimension} from 'vs/base/browser/builder';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybinding';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {ITerminalFont} from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
import {ITerminalProcess, ITerminalService} from 'vs/workbench/parts/terminal/electron-browser/terminal';
@ -39,7 +39,7 @@ export class TerminalInstance {
private contextMenuService: IContextMenuService,
private contextService: IWorkspaceContextService,
private instantiationService: IInstantiationService,
private keybindingService: IKeybindingService,
private keybindingService2: IKeybindingService2,
private terminalService: ITerminalService,
private messageService: IMessageService,
private terminalFocusContextKey: IKeybindingContextKey<boolean>,
@ -169,7 +169,7 @@ export class TerminalInstance {
public setCommandsToSkipShell(commands: string[]): void {
this.skipTerminalKeybindings = commands.map((c) => {
return this.keybindingService.lookupKeybindings(c);
return this.keybindingService2.lookupKeybindings(c);
}).reduce((prev, curr) => {
return prev.concat(curr);
});

View file

@ -14,7 +14,7 @@ import {IActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybinding';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {ITerminalFont, TerminalConfigHelper} from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
@ -48,7 +48,7 @@ export class TerminalPanel extends Panel {
@IConfigurationService private configurationService: IConfigurationService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IInstantiationService private instantiationService: IInstantiationService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService2 private keybindingService2: IKeybindingService2,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ITerminalService private terminalService: ITerminalService,
@IThemeService private themeService: IThemeService,
@ -148,7 +148,7 @@ export class TerminalPanel extends Panel {
getActions: () => TPromise.as(this.getContextMenuActions()),
getActionsContext: () => this.parentDomElement,
getKeyBinding: (action) => {
const opts = this.keybindingService.lookupKeybindings(action.id);
const opts = this.keybindingService2.lookupKeybindings(action.id);
if (opts.length > 0) {
return opts[0]; // only take the first one
}
@ -214,7 +214,7 @@ export class TerminalPanel extends Panel {
this.contextMenuService,
this.contextService,
this.instantiationService,
this.keybindingService,
this.keybindingService2,
this.terminalService,
this.messageService,
terminalFocusContextKey,

View file

@ -13,7 +13,7 @@ import dom = require('vs/base/browser/dom');
import {IContextMenuService, IContextMenuDelegate, ContextSubMenu} from 'vs/platform/contextview/browser/contextView';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IMessageService} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService2} from 'vs/platform/keybinding/common/keybinding';
import {remote, webFrame} from 'electron';
@ -24,7 +24,7 @@ export class ContextMenuService implements IContextMenuService {
constructor(
@IMessageService private messageService: IMessageService,
@ITelemetryService private telemetryService: ITelemetryService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService2 private keybindingService2: IKeybindingService2
) {
}
@ -77,7 +77,7 @@ export class ContextMenuService implements IContextMenuService {
menu.append(submenu);
} else {
const keybinding = !!delegate.getKeyBinding ? delegate.getKeyBinding(e) : undefined;
const accelerator = keybinding && this.keybindingService.getElectronAcceleratorFor(keybinding);
const accelerator = keybinding && this.keybindingService2.getElectronAcceleratorFor(keybinding);
const item = new remote.MenuItem({
label: e.label,

View file

@ -16,7 +16,7 @@ import {KeybindingService, KeybindingService2} from 'vs/platform/keybinding/brow
import {IStatusbarService} from 'vs/platform/statusbar/common/statusbar';
import {IOSupport} from 'vs/platform/keybinding/common/keybindingResolver';
import {ICommandService} from 'vs/platform/commands/common/commands';
import {IKeybindingItem, IUserFriendlyKeybinding} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingService, IKeybindingItem, IUserFriendlyKeybinding} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindingRule, KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {Registry} from 'vs/platform/platform';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
@ -115,10 +115,6 @@ let keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint<ContributedK
});
export class WorkbenchKeybindingService2 extends KeybindingService2 {
}
export class WorkbenchKeybindingService extends KeybindingService {
private contextService: IWorkspaceContextService;
private eventService: IEventService;
private telemetryService: ITelemetryService;
@ -126,15 +122,15 @@ export class WorkbenchKeybindingService extends KeybindingService {
constructor(
domNode: HTMLElement,
@IKeybindingService keybindingService: IKeybindingService,
@ICommandService commandService: ICommandService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IEventService eventService: IEventService,
@ITelemetryService telemetryService: ITelemetryService,
@IMessageService messageService: IMessageService,
@IStatusbarService statusBarService: IStatusbarService
) {
super(commandService, configurationService, messageService, statusBarService);
super(keybindingService, commandService, messageService, statusBarService);
this.contextService = contextService;
this.eventService = eventService;
this.telemetryService = telemetryService;
@ -287,6 +283,14 @@ export class WorkbenchKeybindingService extends KeybindingService {
}
}
export class WorkbenchKeybindingService extends KeybindingService {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super(configurationService);
}
}
let schemaId = 'vscode://schemas/keybindings';
let schema: IJSONSchema = {
'id': schemaId,