"Show automatic Python configurations" button does not update when the active editor changes
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript, vscode
- Ambito
- developer-experience
Direzione di ricerca
Read package.json around lines 692–698 and src/extension/extensionInit.ts around lines 245–249 to trace how dynamicPythonConfigAvailable controls the welcome-view button. Compare the two proposed fixes, then check the existing tests for context keys or active-editor changes. Done means the button reflects the active editor’s language and does not offer to run a non-Python file with debugpy.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The extension contributes a "Show automatic Python configurations" button to the welcome view of Run and Debug. The dynamicPythonConfigAvailable context key controls this button:
The extension sets this context key one time, during activation:
No code updates the key after activation. As a result, the button shows the language of the editor that was active when the extension activated, not the language of the current editor. This causes two problems:
- The button stays visible for non-Python files. The extension usually activates through
onLanguage:python, so the key becomestrue. If you then open a JavaScript or TypeScript file, the button stays in the view. - The button can stay hidden for Python files. If the extension activates through a debug activation event while a non-Python file is active, the key becomes
false. The button does not show when you open a Python file later.
Many projects use Python together with other languages, for example a Python backend with a TypeScript frontend. In these projects, the button often shows for files that debugpy cannot debug.
The first problem can also start the wrong program. The button runs workbench.action.debug.selectandstart for debugpy. The first dynamic configuration is "Python Debugger: Python File", with "program": "${file}". If a non-Python file is active, debugpy tries to run that file as Python.
Steps to reproduce
- Open a folder that has a Python file and a non-Python file (for example,
app.pyandindex.js). Do not add alaunch.json. - Open
app.py. - Open the Run and Debug view. The "Show automatic Python configurations" button shows. This is correct.
- Open
index.js. - Look at the Run and Debug view again.
Expected: The button does not show, because the active file is not Python.
Actual: The button continues to show. If you click it and select "Python Debugger: Python File", debugpy tries to run index.js as a Python program.
Possible fixes
I am very happy to contribute a PR for this! Two options seem good from my perspective:
- Update the key when the active editor changes. Add a
window.onDidChangeActiveTextEditorlistener that setsdynamicPythonConfigAvailableagain. This would be the smallest change. - Use the context keys of the workbench. The core debug welcome view already tracks the language of the active editor with
debugStartLanguageanddebuggerInterestedInActiveEditor. Thewhenclause can change todebugStartLanguage == python && debuggerInterestedInActiveEditor && !virtualWorkspace, and the extension can stop setting its own key.
- Lingua principale
- TypeScript
- Stelle
- 184
- Fork
- 129
- Merge medio
- 4g 17h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/vscode-python-debugger
-
triage-needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/vscode-python-debugger#1110 ·
I maintainer di solito rispondono entro 1 giorno
-
PowerShell script debugpy.ps1 incorrectly handles multiple arguments passed as an arrayForse già presa @nightcityblade l’ha presa 44 giorni fa. Apertatriage-needed
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
microsoft/vscode-python-debugger#1024 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Update dependencies with actionable security alertsForse già presa @copilot-swe-agent l’ha presa 24 giorni fa. Apertatriage-needed
microsoft/vscode-python-debugger#1111 · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Update vulnerable npm dependenciesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertatriage-needed
microsoft/vscode-python-debugger#1104 · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
triage-needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
microsoft/vscode-python-debugger#1052 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/vscode-python-debugger
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
JoviDeCroock/pracht#432 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: CNN en Espanol SDApertaapproved check:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Hardware attribute name "app Connection Support" has inconsistent casingForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
walletbeat/walletbeat#1628 ·
I maintainer di solito rispondono entro 1 giorno
-
bug go
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
genkit-ai/genkit#6761 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NousResearch/hermes-agent#136483 ·
I maintainer di solito rispondono entro 1 giorno