From decf0f60842c69453541f02a80392e6d7f728dd2 Mon Sep 17 00:00:00 2001 From: TEJA P C <39472754+PCTEJA@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:11:47 -0500 Subject: [PATCH] Update dynamicPythonConfigAvailable when the active editor changes The context key gating the 'Show automatic Python configurations' welcome button was set only once during activation, from whichever editor was active then. It now also updates on window.onDidChangeActiveTextEditor, so the button tracks the current editor's language: hidden for non-Python files and shown for Python files opened after activation. Fixes #1122 --- src/extension/extensionInit.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/extension/extensionInit.ts b/src/extension/extensionInit.ts index c4f52b6c..49796ea1 100644 --- a/src/extension/extensionInit.ts +++ b/src/extension/extensionInit.ts @@ -242,11 +242,15 @@ export async function registerDebugger(context: IExtensionContext): Promise { + executeCommand( + 'setContext', + 'dynamicPythonConfigAvailable', + window.activeTextEditor?.document.languageId === 'python', + ); + }; + updateDynamicPythonConfigAvailable(); + context.subscriptions.push(window.onDidChangeActiveTextEditor(updateDynamicPythonConfigAvailable)); context.subscriptions.push( await registerNoConfigDebug(context.environmentVariableCollection, context.extensionPath),