From dac5d24dc20066af8a0bc7fb694f86c079bfcc09 Mon Sep 17 00:00:00 2001 From: arpankanwer Date: Thu, 10 Sep 2026 22:49:42 -0400 Subject: [PATCH] fix: re-assert active editor context on workspace trust change Fixes #335608 Re-observes the active editor when workspace trust changes so File > Save precondition on activeEditor context re-evaluates without requiring an editor switch. --- src/vs/workbench/browser/parts/editor/editorGroupView.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index d9329ba5bf27d..1e432729935f2 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -60,6 +60,7 @@ import { IEditorResolverService } from '../../../services/editor/common/editorRe import { IHostService } from '../../../services/host/browser/host.js'; import { DiffEditorInput } from '../../../common/editor/diffEditorInput.js'; import { FileSystemProviderCapabilities, IFileService } from '../../../../platform/files/common/files.js'; +import { IWorkspaceTrustManagementService } from '../../../../platform/workspace/common/workspaceTrust.js'; export class EditorGroupView extends Themable implements IEditorGroupView { @@ -175,6 +176,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { @IHostService private readonly hostService: IHostService, @IDialogService private readonly dialogService: IDialogService, @IFileService private readonly fileService: IFileService, + @IWorkspaceTrustManagementService private readonly workspaceTrustService: IWorkspaceTrustManagementService, @ICommandService private readonly commandService: ICommandService ) { super(themeService); @@ -391,6 +393,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView { // the dirty state of this editor this._register(this.onDidActiveEditorChange(() => observeActiveEditor())); + // Re-assert active editor context keys on trust change. + this._register(this.workspaceTrustService.onDidChangeTrust(() => observeActiveEditor())); + // Update context keys on startup observeActiveEditor(); updateGroupContextKeys({ kind: GroupModelChangeKind.EDITOR_ACTIVE });