diff --git a/src/vs/editor/browser/standalone/standaloneCodeEditor.ts b/src/vs/editor/browser/standalone/standaloneCodeEditor.ts index 9aba38a080db504957486c090ac6a2358d006f48..f826badcecd4019c8c3162ba8ee8c9a7560cacc4 100644 --- a/src/vs/editor/browser/standalone/standaloneCodeEditor.ts +++ b/src/vs/editor/browser/standalone/standaloneCodeEditor.ts @@ -79,7 +79,7 @@ export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCod } options = options || {}; - super(domElement, options, instantiationService, codeEditorService, commandService, keybindingService, telemetryService); + super(domElement, options, instantiationService, codeEditorService, commandService, keybindingService.createScoped(domElement), telemetryService); if (keybindingService instanceof StandaloneKeybindingService) { this._standaloneKeybindingService = keybindingService; @@ -184,7 +184,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon (keybindingService).setInstantiationService(instantiationService); } - super(domElement, options, editorWorkerService, instantiationService); + super(domElement, options, editorWorkerService, keybindingService, instantiationService); if (keybindingService instanceof StandaloneKeybindingService) { this._standaloneKeybindingService = keybindingService; diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index 33cb1325d06328e1456010efa5aebc0ba329620f..f0de2d9cac63d8e4b8371bb5aa0764bf12e2b6c4 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -15,6 +15,8 @@ import * as dom from 'vs/base/browser/dom'; import {StyleMutator} from 'vs/base/browser/styleMutator'; import {ISashEvent, IVerticalSashLayoutProvider, Sash} from 'vs/base/browser/ui/sash/sash'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; +import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding'; +import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection'; import {DefaultConfig} from 'vs/editor/common/config/defaultConfig'; import {Range} from 'vs/editor/common/core/range'; import * as editorCommon from 'vs/editor/common/editorCommon'; @@ -201,15 +203,18 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif private _updateDecorationsRunner:RunOnceScheduler; private _editorWorkerService: IEditorWorkerService; + private _keybindingService: IKeybindingService; constructor( domElement:HTMLElement, options:editorCommon.IDiffEditorOptions, @IEditorWorkerService editorWorkerService: IEditorWorkerService, + @IKeybindingService keybindingService: IKeybindingService, @IInstantiationService instantiationService: IInstantiationService ) { super(); this._editorWorkerService = editorWorkerService; + this._keybindingService = keybindingService; this.id = (++DIFF_EDITOR_ID); @@ -350,7 +355,8 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif this._containerDomElement.appendChild(this._modifiedDomNode); } - private _createLeftHandSideEditor(options:editorCommon.IDiffEditorOptions, instantiationService:IInstantiationService): void { + private _createLeftHandSideEditor(options: editorCommon.IDiffEditorOptions, instantiationService: IInstantiationService): void { + instantiationService = instantiationService.createChild(new ServiceCollection([IKeybindingService, this._keybindingService.createScoped(this._originalDomNode)])); this.originalEditor = instantiationService.createInstance(CodeEditorWidget, this._originalDomNode, this._adjustOptionsForLeftHandSide(options, this._originalIsEditable)); this._toDispose.push(this.originalEditor.addBulkListener2((events) => this._onOriginalEditorEvents(events))); this._toDispose.push(this.addEmitter2(this.originalEditor)); diff --git a/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts b/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts index c1bc8345d24cc1bbdbf4be1c8dc868900f3c441f..de80b7f38c3c90cdf5c6cfea7fc8ff7b06637a3f 100644 --- a/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts +++ b/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts @@ -29,7 +29,7 @@ export class EmbeddedCodeEditorWidget extends CodeEditorWidget { @IKeybindingService keybindingService: IKeybindingService, @ITelemetryService telemetryService: ITelemetryService ) { - super(domElement, parentEditor.getRawConfiguration(), instantiationService, codeEditorService, commandService, keybindingService, telemetryService); + super(domElement, parentEditor.getRawConfiguration(), instantiationService, codeEditorService, commandService, keybindingService.createScoped(domElement), telemetryService); this._parentEditor = parentEditor; this._overwriteOptions = options; diff --git a/src/vs/editor/common/commonCodeEditor.ts b/src/vs/editor/common/commonCodeEditor.ts index 21fb19b387ebadb847727d601c6802cb9cd5e570..0a1001c35f2d6e2f0f9f61ccb76cc0edf9e4c55f 100644 --- a/src/vs/editor/common/commonCodeEditor.ts +++ b/src/vs/editor/common/commonCodeEditor.ts @@ -143,7 +143,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements editorCom this._lifetimeDispose = []; this._commandService = commandService; - this._keybindingService = keybindingService.createScoped(domElement); + this._keybindingService = keybindingService; this._editorIdContextKey = this._keybindingService.createKey('editorId', this.getId()); this._editorFocusContextKey = this._keybindingService.createKey(editorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS, undefined); this._editorTabMovesFocusKey = this._keybindingService.createKey(editorCommon.KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS, false);