From 46fb8b4f8c05c87d97a101fa47a403693c765d97 Mon Sep 17 00:00:00 2001 From: Jonathan McPherson Date: Thu, 2 Jan 2025 14:32:23 -0800 Subject: [PATCH] don't refresh variables on every console execution --- .../positronVariables/common/positronVariablesService.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/positronVariables/common/positronVariablesService.ts b/src/vs/workbench/services/positronVariables/common/positronVariablesService.ts index 1af53547875..93b32c7c593 100644 --- a/src/vs/workbench/services/positronVariables/common/positronVariablesService.ts +++ b/src/vs/workbench/services/positronVariables/common/positronVariablesService.ts @@ -372,13 +372,20 @@ export class PositronVariablesService extends Disposable implements IPositronVar const { sessionId } = session; + // No-op if this is already the active instance. Setting the active + // instance below triggers a refresh, so avoid it if if the instance is + // already active. + if (this._activePositronVariablesInstance?.session.sessionId === sessionId) { + return; + } + const positronVariablesInstance = this._positronVariablesInstancesBySessionId.get( sessionId ); if (positronVariablesInstance) { this._setActivePositronVariablesInstance(positronVariablesInstance); - return + return; } this._logService.error(`Cannot show Variables: ${formatLanguageRuntimeSession(session)} became active, but a Variables instance for it is not running.`);