Skip to content

Conversation

@dfireBird
Copy link
Contributor

@dfireBird dfireBird commented Dec 20, 2025

fixes #21137

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 20, 2025
@dfireBird dfireBird force-pushed the runnable-subcommand-config branch from dc2bb03 to 97e140f Compare December 20, 2025 18:20
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minus one thing: we generally have X_overrideCommand called for completely overriding the command, and be Option<Vec<String>>, while "X_command": "foo" is a single String and is being integrated in the existing place (cargo foo --args). You can have both are either, but please don't confuse them.

@dfireBird
Copy link
Contributor Author

Oh should this be then Option<Vec<String>>? Cuz we can't have single Single string here especially for doc tests.

@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Dec 20, 2025

As I said, we generally have two configs, one X_overrideCommand: Option<Vec<String>> and one X_command: String. We can not have one if needed.

@dfireBird
Copy link
Contributor Author

I'm really sorry, I’m having some difficulty understanding what you mean.
Are you saying we need to have X_command: String and X_overrideCommand: Option<Vec<String>>, but we should not only have X_overrideCommand as I currently do now, is that right?

@ChayimFriedman2
Copy link
Contributor

Yes.

@dfireBird
Copy link
Contributor Author

dfireBird commented Dec 21, 2025

Oh I see. Thanks. Then I'll make the change for override command to be command and include an arguments config like so:

rust-analyzer.runnables.test.command: String = "test"
rust-analyzer.runnables.test.args: Vec<String> = []

So for example to use nextest those two will be

{
  "rust-analyzer.runnables.test.command": "nextest",
  "rust-analyzer.runnables.test.args": ["run"]
}

Similar for bench and doctest as well.

@dfireBird
Copy link
Contributor Author

I've pushed the changes as separate commit, so that if this change is fine I'll squash them into one before merging (if that's fine).

P.S: I'm sorry for earlier. I had some difficultly understanding what you changed were asked of me.

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not what I suggested. I suggested a pair of fields for each configuration, X_command and X_overrideCommand. No X_args. If this setup does not work for doctests, we cam not provide X_command for it.

@dfireBird
Copy link
Contributor Author

Ah I see. Ok, then I'll remove doctests and include only bench and test.

@dfireBird dfireBird force-pushed the runnable-subcommand-config branch 2 times, most recently from 10ef612 to 3790288 Compare December 22, 2025 03:17
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's still not how we handle those settings.

overrideCommand should not be passed as arguments; if overrideCommand is set, it fully determines the command to run. That's why it's called "override".

Also, you forgot the doctests overrideCommand.

@dfireBird dfireBird force-pushed the runnable-subcommand-config branch from 3790288 to 03135d8 Compare December 25, 2025 14:49
@dfireBird
Copy link
Contributor Author

dfireBird commented Dec 25, 2025

overrideCommand should not be passed as arguments; if overrideCommand is set, it fully determines the command to run. That's why it's called "override".

So the overrideCommand might not even need to invoke cargo (i.e we should not add the overrideCommand to cargo_args)? If that's the case, we lose the ability to add flags or options related to features and target kind or is that fine?

Also, you forgot the doctests overrideCommand.

It's fine if I just overrideCommand for doctests? Without command

@ChayimFriedman2
Copy link
Contributor

So the overrideCommand might not even need to invoke cargo (i.e we should not add the overrideCommand to cargo_args)?

True.

If that's the case, we lose the ability to add flags or options related to features and target kind or is that fine?

You can still use overrideCommand, but you'll have to type the full command.

It's fine if I just overrideCommand for doctests? Without command

Yes, I think.

@dfireBird
Copy link
Contributor Author

dfireBird commented Dec 27, 2025

I'm fine with changing it s it follows as our existing guidelines of configurations. But I feel like it's kinda doesn't work correctly for multiple crate projects like ours, since r-a then won't add the args like --package on overrideCommand

Also the executable args remains as is for the overrideCommand as well right? That is if overrideCommand is used, we still populate the exectable args and pass it or will that have to be not populated as well?

EDIT:
We will have to change the kind in lsp::ext::Runnable as Shell right then, if we are override the full command?

@ChayimFriedman2
Copy link
Contributor

Hmm, we can have placeholders that are substituted for the package name, e.g. ${package}.

@dfireBird
Copy link
Contributor Author

Hmm, Okay. This will complicate it quite a bit, I'll go back a step and come up with better solution of how to use config instead of the plain stuff I do now.

@dfireBird dfireBird force-pushed the runnable-subcommand-config branch from 03135d8 to aab4071 Compare December 29, 2025 14:40
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two things, then LGTM.

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Dec 29, 2025
Merged via the queue into rust-lang:master with commit d711705 Dec 29, 2025
16 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is it possible for Run Test and Run Tests in VS Code to invoke nextest?

3 participants