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

Customize Run / Debug with Command Line Arguments #10408

Open
JP-Ellis opened this issue Oct 1, 2021 · 2 comments
Open

Customize Run / Debug with Command Line Arguments #10408

JP-Ellis opened this issue Oct 1, 2021 · 2 comments
Labels
A-lsp LSP conformance issues and missing features

Comments

@JP-Ellis
Copy link

JP-Ellis commented Oct 1, 2021

Having the ability to quickly run and/or debug an individual test has been absolutely fantastic and in the case of tests and benchmarks, this is very straightforward. It would be nice though if the run/debug could be customized in some way within examples/ (and I'm guessing bin/ too?) where the main function could reasonably expect command line arguments.

I'm not sure what might be the best way to approach this. I can see a two main options:

  1. Adding 'Run with args' and 'Debug with args' to the list of possibilities. Four different run/debug options could become a big cluttered, but as this would not apply to most tests / benchmarks, I'm not sure this would be a big issue.
  2. Adding a 'Customize' option which would create a pre-filled entry in launch.json allowing for the task to be run this way (and customized). Perhaps this could apply more generally?
@matklad
Copy link
Member

matklad commented Oct 2, 2021

Yeah, this is something I very much want to have, but there's a large design space here. The upstream issue is tracked at microsoft/language-server-protocol#944 but, historically, waiting for the upstream (lsp/vscode) wasn't productive.

So perhaps it makes sense to just do it ourselves. I think this mostly requires coding the VS Code side of things. I think the missing pieces are:

  • adding a concept of ID to a run configuration, so that the editor can match run config returned by the server to persisted settings for this specific configuration
  • adding configuration persistance. They probably want to be saved in workspace configuration file (not sure about this)
  • adding templating/prototypical configuration. We should allow tweaking the arguments when running a partciualr test, together with tweaking default arguments when running any tests.
  • some UI affordances to move you from a #[test] function in the source code to the corresponding bit of JSON in the config.

@vsrs
Copy link
Contributor

vsrs commented Oct 15, 2021

2. Adding a 'Customize' option which would create a pre-filled entry in launch.json allowing for the task to be run this way (and customized). Perhaps this could apply more generally?

For Debug you can use "rust-analyzer.newDebugConfig" command ("Generate launch configuration" in UI). It works exactly like described: creates a new configuration in launch.json allowing to specify args, environment, etc.

Unfortunately it does not work for Run

@Veykril Veykril added the A-lsp LSP conformance issues and missing features label Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lsp LSP conformance issues and missing features
Projects
None yet
Development

No branches or pull requests

4 participants