提交 bb84ee81 编写于 作者: J Johannes Rieken

Revert "Revert "code editor creators should create scoped keybinding services or not""

This reverts commit eae1a2f1.
上级 89cce3d7
......@@ -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 = <StandaloneKeybindingService>keybindingService;
......@@ -184,7 +184,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
(<AbstractKeybindingService><any>keybindingService).setInstantiationService(instantiationService);
}
super(domElement, options, editorWorkerService, instantiationService);
super(domElement, options, editorWorkerService, keybindingService, instantiationService);
if (keybindingService instanceof StandaloneKeybindingService) {
this._standaloneKeybindingService = <StandaloneKeybindingService>keybindingService;
......
......@@ -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));
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册