Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/vs/workbench/browser/parts/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ export interface IEditorGroupsView {

readonly onDidVisibilityChange: Event<boolean>;

readonly onDidAddGroup: Event<IEditorGroupView>;
readonly onDidRemoveGroup: Event<IEditorGroupView>;

getGroup(identifier: GroupIdentifier): IEditorGroupView | undefined;
getGroups(order: GroupsOrder): IEditorGroupView[];

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/editor/editorGroupView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._onDidActiveEditorChange.fire({ editor: undefined });

// Remove empty group if we should
if (closeEmptyGroup) {
if (closeEmptyGroup && this.groupsView.getGroup(this.id)) {
this.groupsView.removeGroup(this, preserveFocus);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export class MultiEditorTabsControl extends EditorTabsControl {
this._register(this.editorService.onDidVisibleEditorsChange(() => {
this.editorGroupIndexScheduler.value = scheduleAtNextAnimationFrame(getWindow(this.parent), () => this.updateEditorGroupIndex());
}));

// React to group add/remove to update group index badge (Coderm)
this._register(this.groupsView.onDidRemoveGroup(() => this.updateEditorGroupIndex()));
this._register(this.groupsView.onDidAddGroup(() => this.updateEditorGroupIndex()));
}

protected override create(parent: HTMLElement): HTMLElement {
Expand Down
26 changes: 26 additions & 0 deletions src/vs/workbench/test/browser/workbenchTestServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ export class TestEditorGroupAccessor implements IEditorGroupsView {

onDidChangeEditorPartOptions = Event.None;
onDidVisibilityChange = Event.None;
onDidAddGroup = Event.None;
onDidRemoveGroup = Event.None;

getGroup(identifier: number): IEditorGroupView | undefined { throw new Error('Method not implemented.'); }
getGroups(order: GroupsOrder): IEditorGroupView[] { throw new Error('Method not implemented.'); }
Expand Down Expand Up @@ -1797,6 +1799,9 @@ export class TestWorkspacesService implements IWorkspacesService {
async getWorkspaceIdentifier(workspacePath: URI): Promise<IWorkspaceIdentifier> { throw new Error('Method not implemented.'); }
}

/**
* No-op {@link ITerminalInstanceService} stub for workbench tests.
*/
export class TestTerminalInstanceService implements ITerminalInstanceService {
onDidCreateInstance = Event.None;
onDidRegisterBackend = Event.None;
Expand All @@ -1810,6 +1815,12 @@ export class TestTerminalInstanceService implements ITerminalInstanceService {
getRegisteredBackends(): IterableIterator<ITerminalBackend> { throw new Error('Method not implemented.'); }
}

/**
* No-op {@link ITerminalEditorService} stub for workbench tests.
* Every method throws `"Method not implemented."` — only the events
* are wired to `Event.None` so consumers that subscribe during setup
* do not explode.
*/
export class TestTerminalEditorService implements ITerminalEditorService {
_serviceBrand: undefined;
activeInstance: ITerminalInstance | undefined;
Expand All @@ -1836,6 +1847,10 @@ export class TestTerminalEditorService implements ITerminalEditorService {
findPrevious(): void { throw new Error('Method not implemented.'); }
}

/**
* No-op {@link ITerminalGroupService} stub for workbench tests.
* Mirrors the pattern used by other `Test*Service` classes in this file.
*/
export class TestTerminalGroupService implements ITerminalGroupService {
_serviceBrand: undefined;
activeInstance: ITerminalInstance | undefined;
Expand Down Expand Up @@ -1883,6 +1898,9 @@ export class TestTerminalGroupService implements ITerminalGroupService {
updateVisibility(): void { throw new Error('Method not implemented.'); }
}

/**
* No-op {@link ITerminalProfileService} stub for workbench tests.
*/
export class TestTerminalProfileService implements ITerminalProfileService {
_serviceBrand: undefined;
availableProfiles: ITerminalProfile[] = [];
Expand All @@ -1901,6 +1919,10 @@ export class TestTerminalProfileService implements ITerminalProfileService {
overrideDefaultProfile(extensionIdentifier: string, id: string): IDisposable { return Disposable.None; }
}

/**
* No-op {@link ITerminalProfileResolverService} stub for workbench tests.
* Returns minimal defaults so callers that await profile resolution succeed.
*/
export class TestTerminalProfileResolverService implements ITerminalProfileResolverService {
_serviceBrand: undefined;
defaultProfileName = '';
Expand All @@ -1916,6 +1938,10 @@ export class TestTerminalProfileResolverService implements ITerminalProfileResol
createProfileFromShellAndShellArgs(shell?: unknown, shellArgs?: unknown): Promise<string | ITerminalProfile> { throw new Error('Method not implemented.'); }
}

/**
* Test-friendly subclass of {@link TerminalConfigurationService} that
* exposes the internal font-metrics and config setters for unit tests.
*/
export class TestTerminalConfigurationService extends TerminalConfigurationService {
get fontMetrics() { return this._fontMetrics; }
// eslint-disable-next-line local/code-no-any-casts
Expand Down
Loading