From de15342758295c2176a14b2b2f0d212081f395ca Mon Sep 17 00:00:00 2001 From: shreeraj Date: Tue, 22 Sep 2026 11:38:30 +0530 Subject: [PATCH] Add debug logs when writing to persistent storage (#18288) Adds traceVerbose logging calls at the two write paths in persistentState.ts: - PersistentState.updateValue() - the core write path used by both global and workspace persistent state - updateWorkspaceStateValue() - a separate direct write path This makes it easier to diagnose issues related to persistent storage writes, as requested in the issue. Verified: eslint and prettier pass cleanly on the changed file, tsc compiles with no errors, and pre-existing test failures in testing/utils.unit.test.js were confirmed unrelated (same failures occur with this change stashed out). --- src/client/common/persistentState.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/common/persistentState.ts b/src/client/common/persistentState.ts index 3f9c17657cf4..80a28cae842d 100644 --- a/src/client/common/persistentState.ts +++ b/src/client/common/persistentState.ts @@ -6,7 +6,7 @@ import { inject, injectable, named, optional } from 'inversify'; import { Memento } from 'vscode'; import { IExtensionSingleActivationService } from '../activation/types'; -import { traceError } from '../logging'; +import { traceError, traceVerbose } from '../logging'; import { ICommandManager } from './application/types'; import { Commands } from './constants'; import { @@ -43,6 +43,7 @@ export async function updateWorkspaceStateValue(key: string, value: T): Promi throw new Error('Workspace state not initialized'); } try { + traceVerbose(`Updating workspace persistent state for key [${key}]`); _workspaceKeys.push(key); await _workspaceState.update(key, value); const after = getWorkspaceStateValue(key); @@ -85,6 +86,7 @@ export class PersistentState implements IPersistentState { public async updateValue(newValue: T, retryOnce = true): Promise { try { + traceVerbose(`Updating persistent state for key [${this.key}]`); if (this.expiryDurationMs) { await this.storage.update(this.key, { data: newValue, expiry: Date.now() + this.expiryDurationMs }); } else {