Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename default debugging configuration #412

Closed
qubitron opened this issue Dec 13, 2017 · 9 comments · Fixed by #849
Closed

Rename default debugging configuration #412

qubitron opened this issue Dec 13, 2017 · 9 comments · Fixed by #849
Labels
area-debugging feature-request Request for new features or functionality good first issue
Milestone

Comments

@qubitron
Copy link

Environment data

VS Code version: 1.18.1
Python Extension version: 0.9 release candidate
Python Version: Python 3.6.3
OS and version: Windows 10

Actual behavior

Start debugging fails with output in the debug console:

  File "c:\dev\productionready-django-api\.vscode\launch.json", line 2
    // Use IntelliSense to learn about possible attributes.
     ^
SyntaxError: invalid syntax

After changing to python: django in the debug dropdown debugging works, and continues working even after switching back to "Python" configuration.

Expected behavior

Debugging works

Steps to reproduce:

  • Set up the sample app environment on windows:
git clone github.com/gothinkster/productionready-django-api.git
py -m venv env
env\scripts\activate.bat
pip install -r requirements.txt
  • Click start debugging, launch.json file is generated
  • Click start debugging again to start debugging

Logs

Output from Python output panel

Output from Console window (Help->Developer Tools menu)

@DonJayamanne
Copy link

Looks like you had the launch.json file opened when you clicked the debug icon.
When clicking the debug icon and using the Python debug configuration, the debugger will try to launch the currently active file in Python. I.e. it will try to run launch.json in Python, and that doesnt work, hence the error.

Please open a pythin file when debugging using the Python configuration.

If this isn't intuitive let's discuss that separately

@DonJayamanne
Copy link

Let me know how this goes

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster area-debugging bug Issue identified by VS Code Team member as probable bug labels Dec 13, 2017
@qubitron
Copy link
Author

Yes, this was the issue... caused by the fact that the .json file is created and it gets the main focus. I do think it's unintuitive, and could potentially confuse new first time users.

When you click start debugging it might make sense to prompt you to pick your debugging configuration, and not pop up the .json configuration by default. It might also make sense to name the "Python" configuration to be "Current Python File", so it's obvious that clicking play will attempt to debug whatever file the user has open.

@brettcannon brettcannon added awaiting 1-decision feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster bug Issue identified by VS Code Team member as probable bug labels Dec 13, 2017
@brettcannon
Copy link
Member

brettcannon commented Dec 13, 2017

Short of the file/configuration rename I believe everything else is a VS Code issue. I've tweaked the title to reflect what is being asked of the extension.

@brettcannon brettcannon changed the title Syntax error in launch.json when trying to debug the first time on a django project Rename default debugging configuration Dec 13, 2017
@DonJayamanne
Copy link

When you click start debugging it might make sense to prompt you to pick your debugging configuration, and not pop up the .json configuration by default

Unfortunately this is out of our hands.
What I could do is, check if the current file (defined in the setting program) is launch.json if is so, then display a specific error message for this. I.e. you'd end up with something like this:

I could also is check if file extension is .py, but this woudl be wrong. as in the case of debugging flask apps, the setting program points to an executable.

screen shot 2017-12-13 at 12 26 16 pm

@DonJayamanne
Copy link

Further to this, I believe we could improve the UX by displaying a file picker (using new VS Code API) or similar UI based a condition (such as active file is launch.json or active file is in the workspace but not a python file).

@qubitron
Copy link
Author

@DonJayamanne is it possible, the first time when clicking "Start Debug" and no launch.json file is present, to ask which debug configuration the user wants? Then:

  • Generate the launch.json in the background with all configurations
  • Make the selected configuration the default
  • Start debugging using the selected configuration

This has the added benefit of being a single click (+ selection of configuration) to start debugging the first time. How about also renaming the default configuration to "Python: Current File", so it is explicit about what the default debug config does.

@qubitron
Copy link
Author

qubitron commented Feb 5, 2018

Chatted with Don, we agreed changing the default configuration name to "Python: Current File" would help here.

@DonJayamanne
Copy link

The change was no correct, we need to make changes to the localization files as well (at least for english).

@DonJayamanne DonJayamanne removed their assignment Feb 27, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging feature-request Request for new features or functionality good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants