Repository navigation
Update dynamicPythonConfigAvailable when the active editor changes - #1149
Open
TEJA P C (PCTEJA) wants to merge 1 commit into
Open
TEJA P C (PCTEJA) wants to merge 1 commit into
TEJA P C (PCTEJA) wants to merge 1 commit into
Conversation
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 microsoft#1122
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1122. Implements the first option proposed in that issue ("Update the key when the active editor changes... the smallest change") — credit to the reporter for the analysis and the suggested approach.
The
dynamicPythonConfigAvailablecontext key, which gates the "Show automatic Python configurations" button in the Run and Debug welcome view, was set exactly once during activation from the then-active editor. After that it never changed, so the button:Change
In
registerDebugger(src/extension/extensionInit.ts), the one-timesetContextcall becomes a small local updater that is:window.onDidChangeActiveTextEditor, with the disposable added tocontext.subscriptions.The updater reads
window.activeTextEditorat event time, so closing all editors correctly sets the key tofalse.Testing
npm run compile-tests(tsc) passes;eslintandprettier --checkpass on the changed file.await), and exercised the logic across initial states and editor transitions in a mock harness.extensionInitunit tests do not cover this context key; adding host-level coverage for it would be a welcome follow-up.This change was prepared with AI assistance (Muse, validated with Codex); I have reviewed every changed line and take responsibility for it.