Stream: t-compiler/rust-analyzer

Topic: Code tasks

Laurențiu (Mar 02 2020 at 15:31, on Zulip):

I recall that extensions can contribute tasks, and I believe RLS supports something like this. It would be nice if we could do the same thing. We do have a "Rust Analyzer: Run" command, but it's not integrated with Code and it only seems to support cargo check.

matklad (Mar 02 2020 at 15:37, on Zulip):

The probelm is that Code's tasks are wrong :D

matklad (Mar 02 2020 at 15:38, on Zulip):

They don't have access to the current context, so you can't really "run this test"

Laurențiu (Mar 02 2020 at 15:40, on Zulip):

I'm thinking more of "Run project", assuming you only have one binary in the project or workspace. Or "Debug project" which is even more of a mess currently.

matklad (Mar 02 2020 at 15:45, on Zulip):

Yeah... I am not sure that's actually useful for non-trivial projects...

Creating default actions works if there are few actions. If there are many (and there are many for real projects), that's just bad UX.

What would work is an input box for entering cargo comands, which has completion, and which smartly remmebers last/predefined commands. Basically, exactly how IntellliJ's run configuaration infra works

Laurențiu (Mar 02 2020 at 15:46, on Zulip):

It's helpful for beginners -- "I installed this Rust IDE thing and it doesn't even let me run my programs"

Laurențiu (Mar 02 2020 at 15:48, on Zulip):

And a RLS feature parity gap:


matklad (Mar 02 2020 at 15:48, on Zulip):

Yeah, that's true

matklad (Mar 02 2020 at 15:49, on Zulip):

I guess just irrationally dislike implementing features in less than ideal way :)

Laurențiu (Mar 02 2020 at 15:50, on Zulip):

TBH, for simple stuff I liked the VS experience (hit Ctrl-F5, current project runs) better than the IntelliJ one (open project settings, add a configuration etc.)

Laurențiu (Mar 02 2020 at 15:51, on Zulip):

IntelliJ wins if you need to run different things, change the command line arguments and so on. But most often I didn't need that.

std::Veetaha (Mar 02 2020 at 15:52, on Zulip):

Never used code tasks, npm run stuff or cargo xtask stuff is everything I need

Florian Diebold (Mar 02 2020 at 15:58, on Zulip):

could we have a global "cargo run" command that asks you which binary to run if there are multiple options?

Florian Diebold (Mar 02 2020 at 15:58, on Zulip):

I guess tasks can't run commands...

Laurențiu (Mar 02 2020 at 16:01, on Zulip):

Apparently in RLS you can click the settings icon and you'll get a snipped added to tasks.json, which you can then customize

Florian Diebold (Mar 02 2020 at 16:03, on Zulip):

oh, that's pretty similar to intellij, isn't it (at least how I know it from java)

Laurențiu (Mar 02 2020 at 16:07, on Zulip):

Ah, nifty, I think RLS registers a new task type (cargo) and you can have custom attributes like subcommand

Last update: Jul 24 2021 at 20:15UTC