question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplify generated launch.json

See original GitHub issue

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:

  • DebugConfigurationProvider should use the quickPick to 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 configurationSnippets which 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"
		}
	]
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
DonJayamannecommented, Dec 17, 2018

Changes to be made:

  • Remove default config item Python: Current File (External Terminal), leave it as a configuration snippet
  • Change title of Python: Current File (Integrated Terminal) to Python: Current File.
    • Remove console from this snippet and default config entry
  • When user clicks the add config button then:
    • Display pick list
    • If django is selected, auto populate program, and ask user for input
    • If flask is selected, auto populate program, and ask user for input
    • If attach is selected, auto populate port and host, and ask user for input
1reaction
qubitroncommented, Nov 14, 2018

Sounds good!

@Microsoft/pvsc-team while we’re working on this I have a few other suggestions:

  • Let’s remove (integrated terminal) from the title of the debug configuration, just have “Python: Current File”
  • For flask/django apps, attempt to locate the app.py/manage.py files and prompt the user for the path to them if not found
  • Any other common config variables you think we should prompt for?
Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging in Visual Studio Code
If running and debugging is not yet configured (no launch.json has been created), VS Code shows the Run start view. Simplified initial Run...
Read more >
Why when I create launch.json file in VScode, it is empty?
These steps helped me: Go to your launch.json file and press the "Add Configuration" button img 1. Choose "C/C++: (gdb) Launch" img 2....
Read more >
Quick Tip: How do I recreate my launch.json in VSCode?
Do you manually create a new launch.json file? Do you copy a launch.json file from another project? Do you go to #bcalhelp and...
Read more >
Integration with Visual Studio Code debugging - Microsoft Learn
Select Activity Bar > Microsoft Edge Tools > click the Generate launch.json button, and then press F5 . Or, see Opening DevTools and...
Read more >
Generating the launch.json File_Kunpeng DevKit_Kunpeng DevKit ...
If Visual Studio Code does not have a launch.json file, create one by choosing Run > Add Configuration > Chrome, as shown in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found