fix #197607
This commit is contained in:
Benjamin Simmonds 2023-11-07 12:01:09 +01:00 committed by GitHub
parent d576523abb
commit d2d9072c91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -9,7 +9,7 @@ import { GroupIdentifier, CloseDirection, IEditorCloseEvent, IEditorPane, SaveRe
import { ActiveEditorGroupLockedContext, ActiveEditorDirtyContext, EditorGroupEditorsCountContext, ActiveEditorStickyContext, ActiveEditorPinnedContext, ActiveEditorLastInGroupContext, ActiveEditorFirstInGroupContext, EditorPinnedAndUnpinnedTabsContext, ResourceContextKey, applyAvailableEditorIds, ActiveEditorAvailableEditorIdsContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext } from 'vs/workbench/common/contextkeys';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput';
import { Emitter, Relay, Event } from 'vs/base/common/event';
import { Emitter, Relay } from 'vs/base/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Dimension, trackFocus, addDisposableListener, EventType, EventHelper, findParentWithClass, isAncestor, IDomNodePagePosition, isMouseEvent, isActiveElement, focusWindow } from 'vs/base/browser/dom';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
@ -1915,7 +1915,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
const primary: IAction[] = [];
const secondary: IAction[] = [];
let onDidChange = Event.None;
let onDidChange;
// Editor actions require the editor control to be there, so we retrieve it via service
const activeEditorPane = this.activeEditorPane;
@ -1933,6 +1933,12 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
'navigation',
shouldInlineGroup
);
} else {
// If there is no active pane in the group (it's the last group and it's empty)
// Trigger the change event when the active editor changes
const _onDidChange = new Emitter<void>();
onDidChange = _onDidChange.event;
disposables.add(this.onDidActiveEditorChange(() => _onDidChange.fire()));
}
return { actions: { primary, secondary }, onDidChange };

View file

@ -514,7 +514,7 @@ export const enum OpenEditorContext {
export interface IActiveEditorActions {
readonly actions: IToolbarActions;
readonly onDidChange: Event<IMenuChangeEvent>;
readonly onDidChange: Event<IMenuChangeEvent | void>;
}
export interface IEditorGroup {