Change:
While investigating the issue - - I figured out that entry is of size 46 KB and has around 1K properties. We should revisit this and understand why there are that many workspaceTrust entries and minimise it.
Workspace trust status bar entry does 2 things that are questionable: each entry gets a random identifier [0] the entry is programmatically hidden even if not created [1] If as a user I decide to hide the entry, I would hide it everywhere. [0] [1]
could you please chime in on this as I remember you working on this. Thanks!
This was the relevant message for what we were trying to achieve with the current design
Would it at least be possible to only create the entry when visible and if not, do not create and thus hiding is not needed? The underlying issue here is large amount of state accumulating for hidden trust entries. Typically only a user gesture would set the visibility to hidden, not programmatic as its done here.
I realize that justification talks about unspecified trust state, that is no longer a concept. We also have the banner now. Ok so we can: Only create an entry (unique id), if the entry will be visible (i.e. untrusted). User can hide with status bar UX. Con: User cannot make the entry visible in a trusted workspace if it was never loaded untrusted. We could go to a single entry id, so that visibility is linked across workspaces. Con: trusted workspaces would show if the user wanted to see when untrusted workspace. Single entry id, but dispose the entry when the workspace is trusted. Con: Can't manage the entry when in a trusted window (who cares, right?) I opened a PR for the last one
Yes, thats a great change, even though it causes a slight regression for people in untrusted workspaces that have explicitly hidden the indicator. It will now come back, but then its also easy to hide it again. Given the status bar entry ID is now no longer dynamic, we could actually now clean up the very large state in by removing all entries that are dynamic. I will see to make such a change. Thanks!

Discussion:
*/ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchContribution { <del> private readonly entryId = `status.workspaceTrust.${this.workspaceContextService.getWorkspace().id}`; </del> <ins> private readonly entryId = `status.workspaceTrust`; </ins> private readonly statusbarEntryAccessor: MutableDisposable<IStatusbarEntryAccessor>;

if (this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()) { this.registerListeners(); <del> this.createStatusbarEntry(); </del> <ins> this.updateStatusbarEntry(this.workspaceTrustManagementService.isWorkspaceTrusted()); </ins> // Show modal dialog if (this.hostService.hasFocus) {

//#region Statusbar <del> private createStatusbarEntry(): void { const entry = this.getStatusbarEntry(this.workspaceTrustManagementService.isWorkspaceTrusted()); this.statusbarEntryAccessor.value = this.statusbarService.addEntry(entry, this.entryId, StatusbarAlignment.LEFT, 0.99 * Number.MAX_VALUE /* Right of remote indicator */); this.statusbarService.updateEntryVisibility(this.entryId, false); } </del> private getStatusbarEntry(trusted: boolean): IStatusbarEntry { const text = workspaceTrustToString(trusted);

} private updateStatusbarEntry(trusted: boolean): void { <del> this.statusbarEntryAccessor.value?.update(this.getStatusbarEntry(trusted)); this.statusbarService.updateEntryVisibility(this.entryId, !trusted); </del> <ins> if (trusted && this.statusbarEntryAccessor.value) { this.statusbarEntryAccessor.clear(); return; } if (!trusted && !this.statusbarEntryAccessor.value) { const entry = this.getStatusbarEntry(trusted); this.statusbarEntryAccessor.value = this.statusbarService.addEntry(entry, this.entryId, StatusbarAlignment.LEFT, 0.99 * Number.MAX_VALUE /* Right of remote indicator */); } </ins> } //#endregion