Stream: general

Topic: rust-analyzer


Adeynack (Dec 25 2019 at 18:56, on Zulip):

I have been routed here from the rust-analyzer 's README ... but I find myself confused as of where specifically to ask a question about it. I am having difficulties compiling it (had none 3 weeks ago, but git-pull-ed today and it no longer compiles). Where would be the best channel/stream to ask about it ?

davidtwco (Dec 25 2019 at 18:57, on Zulip):

#t-compiler/wg-rls-2.0 might be a good start

Adeynack (Dec 25 2019 at 19:00, on Zulip):

I assumed they were 2 different projects.

simulacrum (Dec 25 2019 at 19:09, on Zulip):

@Adeynack not really, well, kind of

simulacrum (Dec 25 2019 at 19:09, on Zulip):

rls-2.0 is an umbrella for the future of RLS

simulacrum (Dec 25 2019 at 19:09, on Zulip):

right now rust-analyzer is a proving ground for the new technologies involved in that

zeroexcuses (May 07 2020 at 08:28, on Zulip):

Hi. I'm new to Zulip. I got redirected here from https://github.com/rust-analyzer/rust-analyzer . Can someone point me to the right "get rust-analyzer + vs code to work" channel?

I currently have
rustup 1.21.1
rustc: 1.43.0 stable
components rust-src, rust-analysis installed
vs code version 1.41.1

I have a rust/workspace with ~ 30k LOC rust that works okay (but sometimes laggy) in IntelliJ.

I'm trying to use this same work space in VS Code + RLS + Rust Analyer, but am getting error:

Error: ProtocolError("unexpected message during shutdown: Ok(Response(Response { id: RequestId(U64(1)), result: None, error: Some(ResponseError { code: -32603, message: \"Request window/workDoneProgress/create failed with message: Language client is not ready yet\"thread ', data: None }) }))")<unnamed>
' panicked at 'called Result::unwrap() on an Err value: "SendError(..)"',

bjorn3 (May 07 2020 at 08:46, on Zulip):

The rust-analyzer channel is #t-compiler/wg-rls-2.0.

bjorn3 (May 07 2020 at 08:46, on Zulip):

@zeroexcuses ^

Laurențiu Nicola (May 07 2020 at 08:47, on Zulip):

First of all, I wouldn't use both RLS and rust-analyzer at the same time

zeroexcuses (May 07 2020 at 09:04, on Zulip):

@Laurențiu Nicola : I thought (incorrectly) that rust-analyzer depended on RLS. @bjorn3 : Thanks!

Laurențiu Nicola (May 07 2020 at 09:05, on Zulip):

And you should upgrade to a newer version of Code. rust-analyzer requires the latest one (1.43). Since you're on 1.41, the Code Marketplace sends you an older version of the extension.

zeroexcuses (May 07 2020 at 09:10, on Zulip):

@Laurențiu Nicola I'm running code-1.44.2 now. I _think_ this fixed it (atleast it's trying to index my workspace now). Is there some trivial action I can try to verify if indeed rust-analyzer is working inside of code ?

bjorn3 (May 07 2020 at 09:12, on Zulip):

Try typing something like Vec:: inside a function. It should show multiple functions in the suggestion.

bjorn3 (May 07 2020 at 09:13, on Zulip):

image.png

zeroexcuses (May 07 2020 at 09:13, on Zulip):

If I type in

let x = vec![20]

it fills in the type signature, then if type "x." it gives me auto completion -- this implies it's working? (only active plugins are neo-vim and rust-analyzer)

bjorn3 (May 07 2020 at 09:14, on Zulip):

Yes

zeroexcuses (May 07 2020 at 09:19, on Zulip):

I'm using feature track_caller, which requires nightly. Is there a way to tell rust-analyzer/vscode to use the nightly tool chain rather than the stable tool chain ?

zeroexcuses (May 07 2020 at 09:23, on Zulip):

stable/nightly issue resolved

RalfJ (May 07 2020 at 09:33, on Zulip):

zeroexcuses said:

stable/nightly issue resolved

care to share how for future readers having the same problem? :D

zeroexcuses (May 07 2020 at 09:38, on Zulip):

@RalfJ : The problem is that I did

rustup toolchain install nightly
rustup toolchain uninstall stable

and I did not do a

rustup default nightly

After "rustup default nightly" and restarting vs code, it appears to be working

bjorn3 (May 07 2020 at 09:39, on Zulip):

You can also use rustup override set nightly to use nightly only for the current directory.

zeroexcuses (May 07 2020 at 09:49, on Zulip):

I have more than one physical monitor. I'm also using xmonad to layout windows in particular places (like terminal / compile output immediately to the right of the editor).

In vs code, is it possible to pop out the terminal/compile-output window as a separate window? So far, it seems as if all of code is a single window.

Laurențiu Nicola (May 07 2020 at 09:50, on Zulip):

I don't think Code supports external windows, but you can run a separate terminal anyway. I never got used to the one built-in in Code.

zeroexcuses (May 07 2020 at 09:51, on Zulip):

It's more that I want the unit tests / compile output on a separate vertical window, so that I can scan it, click on errors, and have the editor window jump to the right file / line number.

bjorn3 (May 07 2020 at 09:52, on Zulip):

https://github.com/Microsoft/vscode/issues/10121

2900 upvotes and open for ~4 years

Laurențiu Nicola (May 07 2020 at 09:53, on Zulip):

It's the first one if you sort by :+1:

zeroexcuses (May 07 2020 at 09:57, on Zulip):

I guess I could use xmonad to say: This is not two 3840x2160 monitors. This is one 7680x2160 monitor. Trust me.

zeroexcuses (May 07 2020 at 10:07, on Zulip):

This kinda works. When you click "run test" in vs code, does it end up running _all tests_ in the workspace instead of just the test you click on?

zeroexcuses (May 07 2020 at 10:08, on Zulip):

It appears to run all tests in all crates in the workspace that have the same name. (Instead of just the test in the current crate that has the same name).

zeroexcuses (May 07 2020 at 10:14, on Zulip):

https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/features.md claims there are features for goto def and goto impl; how do I find the hot keys for these ?

bjorn3 (May 07 2020 at 10:16, on Zulip):

goto def is F12

bjorn3 (May 07 2020 at 10:16, on Zulip):

goto impl is ctrl + F12

bjorn3 (May 07 2020 at 10:16, on Zulip):

goto references is shift + F12

zeroexcuses (May 07 2020 at 10:17, on Zulip):

Thanks, I see my problem now. According to xev , 'f12' right now is triggering XF86Eject

bjorn3 (May 07 2020 at 10:17, on Zulip):

image.png

zeroexcuses (May 07 2020 at 10:26, on Zulip):

Got that sorted out. F12 / goto def works now.

Laurențiu Nicola (May 07 2020 at 10:47, on Zulip):

You can also press F1 and type the command you're looking for

zeroexcuses (May 07 2020 at 11:12, on Zulip):

Is there a way to "run last unit test" (and only last unit test). I see the command for "cargo test", but it runs all tests. I like to write a test then continuously run it / edit code / rerun test until it gets fixed.

zeroexcuses (May 07 2020 at 11:12, on Zulip):

I don't want to re-run all tests every time, as that can be time expensive.

bjorn3 (May 07 2020 at 11:14, on Zulip):

If you have cargo-watch installed, you can do cargo watch -s "cargo test -- test_name".

zeroexcuses (May 07 2020 at 11:58, on Zulip):

I have used cargo-watch before, but it's not quite what I want. In IntelliJ + Rust + vim plugin, I have bound <esc> ;rr = rerun last unit test

so it's edit -> ;rr -> click on compile error / runtime error -> loop

Last update: Jun 04 2020 at 17:55UTC