mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-01 13:15:50 +01:00
code editor creators should create scoped keybinding services or not
This commit is contained in:
@@ -76,7 +76,7 @@ export class StandaloneEditor extends CodeEditorWidget implements IStandaloneCod
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
super(domElement, options, instantiationService, codeEditorService, keybindingService, telemetryService);
|
||||
super(domElement, options, instantiationService, codeEditorService, keybindingService.createScoped(domElement), telemetryService);
|
||||
|
||||
if (keybindingService instanceof StandaloneKeybindingService) {
|
||||
this._standaloneKeybindingService = <StandaloneKeybindingService>keybindingService;
|
||||
@@ -181,7 +181,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/keybindingService';
|
||||
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));
|
||||
|
||||
@@ -27,7 +27,7 @@ export class EmbeddedCodeEditorWidget extends CodeEditorWidget {
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@ITelemetryService telemetryService: ITelemetryService
|
||||
) {
|
||||
super(domElement, parentEditor.getRawConfiguration(), instantiationService, codeEditorService, keybindingService, telemetryService);
|
||||
super(domElement, parentEditor.getRawConfiguration(), instantiationService, codeEditorService, keybindingService.createScoped(domElement), telemetryService);
|
||||
|
||||
this._parentEditor = parentEditor;
|
||||
this._overwriteOptions = options;
|
||||
|
||||
@@ -137,7 +137,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
|
||||
// listeners that are kept during the whole editor lifetime
|
||||
this._lifetimeDispose = [];
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user