From bdfb6157618d523cf9b57d9100afcf2800b2fbd5 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Sun, 10 Feb 2019 15:54:17 -0800 Subject: [PATCH] Define IActiveEditor that always has group set This is similar to the IActiveCodeEditor class --- src/vs/workbench/browser/parts/editor/editorCommands.ts | 6 +++--- src/vs/workbench/services/editor/common/editorService.ts | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorCommands.ts b/src/vs/workbench/browser/parts/editor/editorCommands.ts index 9a22dbc334b..462b964ee5c 100644 --- a/src/vs/workbench/browser/parts/editor/editorCommands.ts +++ b/src/vs/workbench/browser/parts/editor/editorCommands.ts @@ -8,7 +8,7 @@ import * as types from 'vs/base/common/types'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { TextCompareEditorVisibleContext, EditorInput, IEditorIdentifier, IEditorCommandsContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, CloseDirection, IEditor, IEditorInput } from 'vs/workbench/common/editor'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorService, IActiveEditor } from 'vs/workbench/services/editor/common/editorService'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor'; import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes'; @@ -113,7 +113,7 @@ function moveActiveEditor(args: ActiveEditorMoveArguments = Object.create(null), } } -function moveActiveTab(args: ActiveEditorMoveArguments, control: IEditor, accessor: ServicesAccessor): void { +function moveActiveTab(args: ActiveEditorMoveArguments, control: IActiveEditor, accessor: ServicesAccessor): void { const group = control.group; let index = group.getIndexOfEditor(control.input); switch (args.to) { @@ -141,7 +141,7 @@ function moveActiveTab(args: ActiveEditorMoveArguments, control: IEditor, access group.moveEditor(control.input, group, { index }); } -function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, control: IEditor, accessor: ServicesAccessor): void { +function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, control: IActiveEditor, accessor: ServicesAccessor): void { const editorGroupService = accessor.get(IEditorGroupsService); const configurationService = accessor.get(IConfigurationService); diff --git a/src/vs/workbench/services/editor/common/editorService.ts b/src/vs/workbench/services/editor/common/editorService.ts index 462dd7f33a0..9fe2e5df047 100644 --- a/src/vs/workbench/services/editor/common/editorService.ts +++ b/src/vs/workbench/services/editor/common/editorService.ts @@ -39,6 +39,11 @@ export interface IOpenEditorOverride { override?: Promise; } +export interface IActiveEditor extends IEditor { + input: IEditorInput; + group: IEditorGroup; +} + export interface IEditorService { _serviceBrand: ServiceIdentifier; @@ -69,7 +74,7 @@ export interface IEditorService { * * @see `IEditorService.activeEditor` */ - readonly activeControl: IEditor; + readonly activeControl: IActiveEditor; /** * The currently active text editor widget or `undefined` if there is currently no active -- GitLab