Repository navigation
Simplify generated launch.json #3321
Copy link
Copy link
Closed
Labels
area-debuggingfeature-requestRequest for new features or functionalityRequest for new features or functionality
Milestone
Description
Hey,
VSCode dev here. This milestone I am looking into simplifing generated launch.json for various extensions microsoft/vscode#62851
The launch.json that Python generates is attached at the end. This is far too complex for the avarage user. I suggest to simplify it the following way:
-
DebugConfigurationProvidershould use thequickPickto ask the user if he would like to debug the current file, attach, debug a python module, python django or debug python flask. Based on the user response only generate one configuration - Remove host: "localhost" from the
attach, this should be the default value and should not be specified - If you strongly feel that the user should be asked what console to use, also ask that as a follow up question. IMHO this should not be asked, and just generate what you think is the best default experience
- If the port is not standard also ask the user for it using
quickInput, example - You are already contributing
configurationSnippetswhich is great
If you agree with the suggestions I am making here I am also here to help with any potential questions you might have. The changes should not require a lot of work but will simplify the flow a lot imho.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost"
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "enter-your-module-name-here",
"console": "integratedTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
}
]
}
Reactions are currently unavailable
Metadata
Metadata
Labels
area-debuggingfeature-requestRequest for new features or functionalityRequest for new features or functionality
Activity
qubitron commentedon Nov 13, 2018
Hi Isidor Nikolic (@isidorn), I like the direction, but want to make sure this doesn't add confusion for users who aren't using debug configurations. In our user tests we see the large majority of new users launch debugging from the Debug menu using Debug -> Start Debugging without using the debug activity view:

Which doesn't surface the ability to select/change the current debug configuration, so if the user made bad choices on their first attempt, debugging will be broken for the current workspace without an obvious way to fix it.
The other concern I have is that currently adding another configuration takes me to a different experience (Python Configurations may not be in view), and doesn't make the new configuration the active one:

Which is problematic because:
So my suggestion would be that:
Set Active Configurationmenu option next toAdd Configuration)With regards to your suggestions above for the configurations:
Let me know what you think of the above!
isidorn commentedon Nov 14, 2018
Dan Taylor (@qubitron) thanks a lot for you quick reply. Very good points.
Once you have some version of the quick pick help in launch.json generation working let me know and I can try it out to provide more feedback.
Apart from this please let me know if there is anything else on the vscode side which we should add that could potentially make the debug setup for pyhton much easier. I do not know what are the biggest pain points here for the python users when it comes to configuring debugging.
qubitron commentedon Nov 14, 2018
Sounds good!
@Microsoft/pvsc-team while we're working on this I have a few other suggestions:
brettcannon commentedon Nov 14, 2018
Related may be #2710
24 remaining items
DonJayamanne commentedon Mar 29, 2019
Luciana Abud (@luabud) Dan Taylor (@qubitron)
*in front ofPythonto ensure it is placed on the top.*will placePythonat the bottom along with others.Pythonitem in the list, but VSC will decide whether to display that item as pre-selected or not.Note The item
Pythonwill appear when:Add Configurationbutton inlaunch.jsonfile.Option 1: With
*Option 2: Without
*(still works)Display python debug config ui when editing launch.json (#5016)
DonJayamanne commentedon Apr 8, 2019
Whats been implemented:
launch.jsondoes not exist and one attempts to debug, then user will be prompted to pick a debug configurationlaunch.jsondoes not exist and one attempts to create a debug configuration (i.e.launch.json), then user will be prompted to pick a debug configuration and thelaunch.jsoncreated will contain that debug configurationlaunch.jsonuser will have the ability to choose a debug configuration from the above UI (we now display the standard snippets and display an additionalPythonitem which when selected will display the prompts)ericsnowcurrently commentedon Apr 8, 2019
I've verified that this works;
Auto-completion in the launch.json works too, though it didn't let me select one of the original 6 pre-built configs.
DonJayamanne commentedon Apr 8, 2019
Eric Snow (@ericsnowcurrently) what do you mean by this?