Skip to content

Display message if active file being debugged is not a python file #1178

Closed as not planned

Description

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.

Brett Cannon (@brettcannon) Dan Taylor (@qubitron)
Thoughts

Activity

  1. 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
  2. qubitron commented on Mar 26, 2018

    @qubitron

    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.

  3. Anapo14 commented on Oct 24, 2019

    @Anapo14

    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.

  4. cpinamtz commented on Apr 7, 2023

    @cpinamtz

    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?
    image

  5. brettcannon commented on Apr 10, 2023

    @brettcannon
    Member

    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.

  6. locked as resolved and limited conversation to collaborators on May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions