Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Simplify generated launch.json #404

Closed
3 tasks
isidorn opened this issue Nov 9, 2018 · 11 comments
Closed
3 tasks

Simplify generated launch.json #404

isidorn opened this issue Nov 9, 2018 · 11 comments

Comments

@isidorn
Copy link

isidorn commented Nov 9, 2018

Hey,

VSCode dev here. This milestone I am looking into simplifing generated launch.json for various extensions microsoft/vscode#62851
The launch.json that ruby generates is the following:

{
	// 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": "Debug Local File",
			"type": "Ruby",
			"request": "launch",
			"cwd": "${workspaceRoot}",
			"program": "${workspaceRoot}/main.rb"
		},
		{
			"name": "Listen for rdebug-ide",
			"type": "Ruby",
			"request": "attach",
			"cwd": "${workspaceRoot}",
			"remoteHost": "127.0.0.1",
			"remotePort": "1234",
			"remoteWorkspaceRoot": "${workspaceRoot}"
		},
		{
			"name": "Rails server",
			"type": "Ruby",
			"request": "launch",
			"cwd": "${workspaceRoot}",
			"program": "${workspaceRoot}/bin/rails",
			"args": [
				"server"
			]
		},
		{
			"name": "RSpec - all",
			"type": "Ruby",
			"request": "launch",
			"cwd": "${workspaceRoot}",
			"program": "${workspaceRoot}/bin/rspec",
			"args": [
				"-I",
				"${workspaceRoot}"
			]
		},
		{
			"name": "RSpec - active spec file only",
			"type": "Ruby",
			"request": "launch",
			"cwd": "${workspaceRoot}",
			"program": "${workspaceRoot}/bin/rspec",
			"args": [
				"-I",
				"${workspaceRoot}",
				"${file}"
			]
		},
		{
			"name": "Cucumber",
			"type": "Ruby",
			"request": "launch",
			"cwd": "${workspaceRoot}",
			"program": "${workspaceRoot}/bin/cucumber"
		}
	]
}

This is simply overwhelming and I believe it should be improved with the following:

  • cwd should not be in every configuration, instead the default value should be ${workspaceRoot}. You can register a DebugConifgurationProvider which will just resovle every launch configuration by appending "cwd": ${workspaceRoot}
  • All these configurations should be contributed also as snippets, since then they would be offered in inteli-sense when user presses Add Configuration blue button. Example
  • When the launch.json needs to be generated the suer should be asked via QuickPick what kind of launch configuraiton he wants. Based on his response we should just generate that configuration, and not all of the above. If you are interested in doing this I can point you to an example I will write in a couple of days.

All of this should be pretty straightforward. Please let me know if you need help.

@wingrunr21
Copy link
Collaborator

Hi @isidorn

Thank you for the suggestions. A PR would be most helpful but otherwise I'll get to it when I get to it.

@isidorn
Copy link
Author

isidorn commented Nov 9, 2018

@wingrunr21 this milestone I am doing this for 10+ extension so doing 10+ PRs for me does not really scale for me.
So it would be awesome if you do this when you find the time. I can help with questions of course.

@wingrunr21
Copy link
Collaborator

Understood. The comment was also geared towards others viewing this issue. My work on this extension is only in my free time and I've got much bigger fish to fry in this extension right now.

As it stands, the debugger requires quite a bit of love in this extension in general. So, this will get done when I get a PR for it or I get time.

Thanks

@isidorn
Copy link
Author

isidorn commented Nov 9, 2018

I will create a help-wanted issue in the vscode repository which links to this one.
Since we have a big traffic of contributers, somebody might show up

@YisraelV
Copy link
Contributor

@isidorn can you tell me of any extension that uses the quickpick so I can have a look?

@isidorn
Copy link
Author

isidorn commented Nov 30, 2018

@YisraelV sure, here's an example microsoft/vscode-docker#618
But I think this extension needs some more love with regards to debugging.
@wingrunr21 would be best to provide exact pointers here.

@YisraelV
Copy link
Contributor

YisraelV commented Nov 30, 2018

@wingrunr21 thought I'd follow the first post suggestions

  1. only one configuration is created depending on selection in ui.
  2. the rest of the suggestions are available through snippets.
  3. cwd is not shown and gets a default of workspace root

What do you think?

@wingrunr21
Copy link
Collaborator

Sounds good to me. I can push these changes out with a few of the other changes staged in master.

@wingrunr21
Copy link
Collaborator

This should be resolved by #408.

@YisraelV
Copy link
Contributor

YisraelV commented Dec 9, 2018

@wingrunr21 thanks for taking the time to merge.

@isidorn
Copy link
Author

isidorn commented Dec 10, 2018

Awesome work, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants