Skip to content

Commit

Permalink
Define IActiveEditor that always has group set
Browse files Browse the repository at this point in the history
This is similar to the IActiveCodeEditor class
  • Loading branch information
mjbvz committed Feb 11, 2019
1 parent 7ca2c0a commit bdfb615
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/parts/editor/editorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down
7 changes: 6 additions & 1 deletion src/vs/workbench/services/editor/common/editorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export interface IOpenEditorOverride {
override?: Promise<IEditor>;
}

export interface IActiveEditor extends IEditor {
input: IEditorInput;
group: IEditorGroup;
}

export interface IEditorService {
_serviceBrand: ServiceIdentifier<any>;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bdfb615

Please sign in to comment.