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

How can a user run more than one cargo watch command? #3596

Closed
Lokathor opened this issue Mar 14, 2020 · 14 comments
Closed

How can a user run more than one cargo watch command? #3596

Lokathor opened this issue Mar 14, 2020 · 14 comments

Comments

@Lokathor
Copy link

In cargo watch you can use -x for each thing you want it to do, so you could write

cargo watch -x build -x clippy

And you'd get a build and a clippy run. However, I'm not seeing how to do this in RA.

@kiljacken
Copy link
Contributor

This is not currently supported, and I'm uncertain whether we want to support it given the amount of trouble running a single command from the server already causes :)

@Lokathor
Copy link
Author

Okay then can you add a way to run specifically clippy as well as another command?

@matklad
Copy link
Member

matklad commented Mar 16, 2020

Note also that long-term, we will remove cargo check execution from rust-analyzer completely, and instead just compute all the diagnostics on the fly, internally. So the long term answer here is that a user needs cargo watch external process anyway.

@Lokathor
Copy link
Author

Well rust-analyzer should have some way of running clippy directly in that case.

@matklad
Copy link
Member

matklad commented Jul 15, 2020

See

#5383 (comment)

@matklad matklad closed this as completed Jul 15, 2020
@Lokathor
Copy link
Author

Wait you gotta document that somewhere in the readme or something.

Just putting a comment at the end of a closed issue is not helping the users.

@matklad
Copy link
Member

matklad commented Jul 15, 2020

Yeah, I might not forget about this next time I get to updating the manual. But this is mostly build-in vscode feature, so I don’t think we necessary must document it ourselves.

@Lokathor
Copy link
Author

I read the comment though, and I don't even know what it actually means. Like where do I even put that json block? It's completely unclear.

I think that maybe you're too good at using VS Code, and you've forgotten that most of us actually have no idea how anything with it works ;P

@Michael-F-Bryan
Copy link
Contributor

Like where do I even put that json block? It's completely unclear.

I googled "vs code task" (keywords mentioned in the original comment) and the first result was Integrate with External Tools via Tasks from the official VS Code docs telling me all about how tasks work.

The problem you're always going to have is that rust-analyzer has a lot of features, so even if the relevant information was in the manual it'd be hard to discover because not everyone reads to the end. Plus the line is quite blurry between VS Code and the rust-analyzer plugin, so it's hard to know which project is responsible for documenting a particular feature.

@matklad
Copy link
Member

matklad commented Jul 16, 2020

Yeah, my long-term strategy is to crowd-source documentation for all editors. Doesn't work as good as I would like so far, I've bumped the link to the source:

image

@lnicola
Copy link
Member

lnicola commented Jul 16, 2020

You can also set cargo clippy as the check command and run cargo watch -x build in a terminal. There used to be some problems with warnings reported only once, but I think they work fine now.

@Lokathor
Copy link
Author

The problem is that I want cargo build as my "check" command, and then I can't have clippy for free.

@lnicola
Copy link
Member

lnicola commented Jul 16, 2020

The problem is that I want cargo build as my "check" command

Why? cargo clippy will report the same warnings, and you can build the code in the background with cargo watch.

@Lokathor
Copy link
Author

Well however it happens I don't super care I suppose. The point is that in the GUI for the rust-analyzer settings that you get in VS Code you can only input one command to have rust-analyzer's cargo watch do on repeat, and I want more than one command.

Exactly what those "more than one command" actions are seems unimportant, because various users will have their own needs.

Which is why we need this documentation about how to setup an additional automatic cargo watch, as provided by the PR that referenced this topic (#5407).

bors bot added a commit that referenced this issue Jul 16, 2020
5407: Mentioned problem matchers and running cargo-watch as a VS Code Task r=matklad a=Michael-F-Bryan

See #3596 (comment).

Co-authored-by: Michael-F-Bryan <michaelfbryan@gmail.com>
Co-authored-by: Michael Bryan <Michael-F-Bryan@users.noreply.github.com>
bors added a commit that referenced this issue Jun 20, 2024
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

No branches or pull requests

5 participants