KEMBAR78
Simplify generated launch.json · Issue #404 · rubyide/vscode-ruby · GitHub
Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Simplify generated launch.json #404

@isidorn

Description

@isidorn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions