"Show automatic Python configurations" button does not update when the active editor changes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript, vscode
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 182
- フォーク
- 125
- 平均マージ
- 4日 17時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/vscode-python-debugger のほかの issue
-
triage-needed
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/vscode-python-debugger#1110 ·
メンテナーはふだん 1 日以内に返信
-
PowerShell script debugpy.ps1 incorrectly handles multiple arguments passed as an array対応中かも @nightcityblade が 44 日前に担当しました。 オープンtriage-needed
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/vscode-python-debugger#1024 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Update dependencies with actionable security alerts対応中かも @copilot-swe-agent が 23 日前に担当しました。 オープンtriage-needed
microsoft/vscode-python-debugger#1111 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Update vulnerable npm dependencies再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンtriage-needed
microsoft/vscode-python-debugger#1104 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
triage-needed
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
microsoft/vscode-python-debugger#1052 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/vscode-python-debugger の issue をすべて見る
似ている issue
-
Dependencies view: `getParent` loops forever on untitled documents, extension host runs out of memory対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1時間未満 初心者へのやさしさ 82/100
awslabs/visual-asset-management-system#413 ·
メンテナーはふだん 1 日以内に返信
-
bug confirmed perf
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
videojs/video.js#9400 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug pending triage scope/agent
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
good first issue hacktoberfest
難易度 2/5 半日 初心者へのやさしさ 70/100
HelpCode-ai/anythingmcp#996 ·
メンテナーはふだん 1 日以内に返信