You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Display message if active file being debugged is not a python file #1178
This applies to both experimental & current debugger
Very often we have users attempting to debug python code with the launch.json file opened.
In such a situation, launch.json is treated as the active file and python debugger will attempt to debug this.
Proposed solution:
Display a message if active file is not a python file
If there are at least 2 python file opened in the editor, then display a file picker (or drop down list), allowing the user to select a file to debug
If there is only one python file opened in the editor, use that for debugging
This will avoid a lot of confusion amongst users (I've seen our own devs get confused fall into this trap).
Might want to consider getting this into March release.
changed the title [-]Display message or similar if `json` file is selected for debugging[/-][+]Display message if active file being debugged is not a python file[/+]on Mar 24, 2018
Don Jayamanne (@DonJayamanne) I think a message is sufficient here: "Your debugging configuration is set to debug the current file, but the current file is not a Python file. Please open a Python file and try again". Once you realize what the problem is it is easy to fix, no need to add UI for displaying a file picker and if we try to be too smart it might be more of a headache to maintain.
Does it makes sense to keep this issue opened (at the moment of writing this, VSCode v1.77.0 and vscode-python extension v2023.6.0) when the IDE distinguishes whether the current opened file is or not a Python file to display the Run Python File and sub-option Debug Python File?
Carlos Piña Martinez (@cpinamtz) thanks for the ping on this! I think you're right it isn't worth keeping open for the reasons you listed and there's only a single upvote after over 5 years.
Activity
[-]Display message or similar if `json` file is selected for debugging[/-][+]Display message if active file being debugged is not a python file[/+]qubitron commentedon Mar 26, 2018
Don Jayamanne (@DonJayamanne) I think a message is sufficient here: "Your debugging configuration is set to debug the current file, but the current file is not a Python file. Please open a Python file and try again". Once you realize what the problem is it is easy to fix, no need to add UI for displaying a file picker and if we try to be too smart it might be more of a headache to maintain.
Anapo14 commentedon Oct 24, 2019
We could add a link to this. It has info on trying to debug the launch.json file. Users may be curious to learn more.
cpinamtz commentedon Apr 7, 2023
Does it makes sense to keep this issue opened (at the moment of writing this, VSCode v1.77.0 and

vscode-pythonextension v2023.6.0) when the IDE distinguishes whether the current opened file is or not a Python file to display theRun Python Fileand sub-optionDebug Python File?brettcannon commentedon Apr 10, 2023
Carlos Piña Martinez (@cpinamtz) thanks for the ping on this! I think you're right it isn't worth keeping open for the reasons you listed and there's only a single upvote after over 5 years.