diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index c9a53a542e1f1a59d5b774a7c29eba2ec9f704a4..d7bea9d96b3e17ab27702adca601c09d49324e47 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -33,7 +33,6 @@ import { IStorageService, StorageScope, IWillSaveStateEvent, WillSaveStateReason import { ContextMenuService as HTMLContextMenuService } from 'vs/platform/contextview/browser/contextMenuService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IFileService } from 'vs/platform/files/common/files'; @@ -110,7 +109,6 @@ import { TextResourcePropertiesService } from 'vs/workbench/services/textfile/no // import@electron-browser import { ContextMenuService as NativeContextMenuService } from 'vs/workbench/services/contextmenu/electron-browser/contextmenuService'; -import { WorkbenchKeybindingService } from 'vs/workbench/services/keybinding/electron-browser/keybindingService'; import { LifecycleService } from 'vs/platform/lifecycle/electron-browser/lifecycleService'; import { WindowService } from 'vs/platform/windows/electron-browser/windowService'; import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-browser/remoteAuthorityResolverService'; @@ -420,9 +418,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService { // Context Keys serviceCollection.set(IContextKeyService, new SyncDescriptor(ContextKeyService)); - // Keybindings - serviceCollection.set(IKeybindingService, new SyncDescriptor(WorkbenchKeybindingService, [window])); - // Context view service serviceCollection.set(IContextViewService, new SyncDescriptor(ContextViewService, [this.workbench], true)); diff --git a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts index 3c7899079ab488955c58f2151db3b5a2eff4c09a..314a3212c7a484e7a9259c821d707284871de52c 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts @@ -22,7 +22,7 @@ import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/commo import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; import { AbstractKeybindingService } from 'vs/platform/keybinding/common/abstractKeybindingService'; -import { IKeybindingEvent, IKeyboardEvent, IUserFriendlyKeybinding, KeybindingSource } from 'vs/platform/keybinding/common/keybinding'; +import { IKeybindingEvent, IKeyboardEvent, IUserFriendlyKeybinding, KeybindingSource, IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver'; import { IKeybindingItem, IKeybindingRule2, KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem'; @@ -40,6 +40,7 @@ import { IWindowsKeyboardMapping, WindowsKeyboardMapper, windowsKeyboardMappingE import { IWindowService } from 'vs/platform/windows/common/windows'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { MenuRegistry } from 'vs/platform/actions/common/actions'; +import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class KeyboardMapperFactory { public static readonly INSTANCE = new KeyboardMapperFactory(); @@ -269,7 +270,6 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService { private userKeybindings: ConfigWatcher; constructor( - windowElement: Window, @IContextKeyService contextKeyService: IContextKeyService, @ICommandService commandService: ICommandService, @ITelemetryService telemetryService: ITelemetryService, @@ -326,7 +326,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService { keybindings: event.config }))); - this._register(dom.addDisposableListener(windowElement, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { + this._register(dom.addDisposableListener(window, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { let keyEvent = new StandardKeyboardEvent(e); let shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target); if (shouldPreventDefault) { @@ -712,3 +712,5 @@ const keyboardConfiguration: IConfigurationNode = { }; configurationRegistry.registerConfiguration(keyboardConfiguration); + +registerSingleton(IKeybindingService, WorkbenchKeybindingService); \ No newline at end of file diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index d3f06732e7f18d51db438fb79b679178d0bb6b87..103a7d53f0f7274a68678d4214db7f85bf8070ea 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -81,6 +81,7 @@ import 'vs/workbench/services/history/browser/history'; import 'vs/workbench/services/files/node/remoteFileService'; import 'vs/workbench/services/activity/browser/activityService'; import 'vs/workbench/browser/parts/views/views'; +import 'vs/workbench/services/keybinding/electron-browser/keybindingService'; import 'vs/workbench/browser/parts/quickinput/quickInput'; import 'vs/workbench/browser/parts/quickopen/quickOpenController'; import 'vs/workbench/browser/parts/titlebar/titlebarPart';