Skip to content

Commit d32043d

Browse files
authored
Update group context keys on reload (microsoft#201277)
1 parent ce27104 commit d32043d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/vs/workbench/browser/parts/editor/editorGroupView.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
281281
};
282282

283283
// Update group contexts based on group changes
284-
this._register(this.onDidModelChange(e => {
284+
const updateGroupContextKeys = (e: IGroupModelChangeEvent) => {
285285
switch (e.kind) {
286286
case GroupModelChangeKind.GROUP_LOCKED:
287287
groupLockedContext.set(this.isLocked);
@@ -312,16 +312,18 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
312312

313313
// Group editors count context
314314
groupEditorsCountContext.set(this.count);
315-
}));
315+
};
316+
317+
this._register(this.onDidModelChange(e => updateGroupContextKeys(e)));
316318

317319
// Track the active editor and update context key that reflects
318320
// the dirty state of this editor
319-
this._register(this.onDidActiveEditorChange(() => {
320-
observeActiveEditor();
321-
}));
321+
this._register(this.onDidActiveEditorChange(() => observeActiveEditor()));
322322

323323
// Update context keys on startup
324324
observeActiveEditor();
325+
updateGroupContextKeys({ kind: GroupModelChangeKind.EDITOR_ACTIVE });
326+
updateGroupContextKeys({ kind: GroupModelChangeKind.GROUP_LOCKED });
325327
}
326328

327329
private registerContainerListeners(): void {

0 commit comments

Comments
 (0)