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

Are there plans to add "useBundler" and "pathToBundler" settings to launch.json for debugging? #1907

Open
1 task done
dimonker opened this issue Apr 10, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@dimonker
Copy link

I have checked that this feature is not already implemented

  • This feature does not exist

Use case

We are planning to migrate from VS Code extension https://github.com/rubyide/vscode-ruby to your extension, but we are missing two settings in launch.json "pathToBundler" and "useBundler".
https://github.com/rubyide/vscode-ruby/wiki/2.-Launching-from-VS-Code#pathtobundler
https://github.com/rubyide/vscode-ruby/wiki/2.-Launching-from-VS-Code#usebundler

Description

Are there plans to add "useBundler" and "pathToBundler" settings to launch.json for debugging?

Implementation

No response

@dimonker dimonker added the enhancement New feature or request label Apr 10, 2024
@vinistock
Copy link
Member

Thank you for the feature suggestion. Can you give me an example launch.json?

I don't believe you need those configurations at all. The Ruby LSP hooks into your version manager to activate the Ruby environment, which means it should be able to find Bundler without you having to specify the path to it.

And if you want to use Bundler when launching a Ruby script, all you have to do is including bundle exec as part of the program configuration.

@dimonker
Copy link
Author

Thank you, including bundle exec as part of the program configuration helped, but as it turned out, we still need the "args" and "cwd" settings.

Here is an example of current launch.json:

{
  "version": "0.2.0",
  "configurations": [{
      "name": "Debug Danger",
      "type": "Ruby",
      "request": "launch",
      "script": "${workspaceRoot}/bin/danger",
      "args": [
        "--dangerfile=${workspaceRoot}/path_to_dangerfile",
        "dry_run"
      ],
      "env": {
        "DEBUG": true
      },
      "cwd": "${workspaceRoot:project}",
      "bundlePath": "${workspaceRoot}/bin/bundle",
      "useBundler": true
    }
  ]
}

I managed to figure out the "args" setting, but what to do with the "cwd" setting is unclear. And the resulting version of launch.json for your extension is like this:

{
  "version": "0.2.0",
  "configurations": [{
      "name": "Debug Danger",
      "type": "ruby_lsp",
      "request": "launch",
      "program": "${workspaceRoot}/bin/bundle exec ${workspaceRoot}/bin/danger --dangerfile=${workspaceRoot}/path_to_dangerfile dry_run",
      "env": {
        "DEBUG": true
      },
      "cwd": "${workspaceRoot:project}"
    }
  ]
}

@vinistock
Copy link
Member

Why do you need to set the cwd? Do you have multiple workspaces configured? And if that's the case, does moving the launch.json file inside that workspace fix the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants