rust-lang / rust-lang/rust-analyzer

Runnables: Extra Args sets Args instead of Extra Args

Open
#13,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-support
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer version: 0.3.1221-standalone

rustc version: (eg. output of rustc -V)

rustc 1.63.0 (4b91a6ea7 2022-08-08)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)
RUST_TEST_THREADS=1 (workaround set via Runnables:Env) others unset

I might be wrong, but it seems to me that:

The description says:
Additional arguments to be passed to cargo for runnables such as tests or binaries. For example, it may be --release.

However, there seems to be no possibility to set values, i.e. arguments that appear after --.

The rust-analyzer source code speaks of args and extra_args.

match kind

In particular, I tried to set the test-threads=1 extra argument, which fails as it is inserted before the --.
The workaround is to use the older environment variable RUST_TEST_THREADS, but the command line argument is preferred as far as I understood.

Have I missed something, or is this a possible issue?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/rust-analyzer/src/cargo_target_spec.rs, especially the handling of args and extra_args linked in the report. Reproduce a runnable with an extra argument such as test-threads=1 and verify that the generated command places it after -- rather than among Cargo's arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.