rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Doesn't load new workspace

Open Da1sypetals opened this issue 1 year ago • 11 comments

Please first note that this is not a duplicate of https://github.com/rust-lang/rust-analyzer/issues/17739. I am a beginner so this question may be silly. When I created a new project with cargo new tutorial and this is my dir:

.
├── Cargo.lock
├── Cargo.toml
├── src
    └── main.rs
(omitting target/)

And I cannot use rust-analyzer in VScode There may be an answer on the internet, but I googled for hours and did not find any. Please help, thanks a lot in advance.


More info if this helps: on WSL2, ubuntu 22.04

(playground) ‹da1sypetals@LAPTOP-P07PKIRG›
 /mnt/a/dev/rs/tutorial > cargo --version   
cargo 1.80.0 (376290515 2024-07-16)

(playground) ‹da1sypetals@LAPTOP-P07PKIRG›
 /mnt/a/dev/rs/tutorial > rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.80.0 (051478957 2024-07-21)`

(playground) ‹da1sypetals@LAPTOP-P07PKIRG›
 /mnt/a/dev/rs/tutorial > rust-analyzer --version
rust-analyzer 1.80.0 (0514789 2024-07-21)

Da1sypetals avatar Jul 31 '24 16:07 Da1sypetals

Duplicate of https://github.com/rust-lang/rust-analyzer/issues/17739, but you can ignore the error.

lnicola avatar Jul 31 '24 16:07 lnicola

Duplicate of #17739, but you can ignore the error.

No I cannot, since the rust-analyzer plugin just does not work without this resolved, and I don't get code hints/intellisense. I have also read that issue inside-out, without getting a solution.

Da1sypetals avatar Jul 31 '24 16:07 Da1sypetals

Okay, but it's still a duplicate of that issue, and you can work around it by adding a .cargo/config.toml file with a single [env] line.

lnicola avatar Jul 31 '24 17:07 lnicola

Actually no, there's no reason why the missing file would cause a problem...

lnicola avatar Jul 31 '24 17:07 lnicola

I can confirm that this is only a cosmetic issue:

image

Do you have any other errors?

lnicola avatar Jul 31 '24 17:07 lnicola

I can confirm that this is only a cosmetic issue:我可以确认,这只是一个外观问题:

image

Do you have any other errors?还有其他错误吗?

I have the same situation, adding [env] does not work, and it is not just a cosmetic issue in my case. Three months ago version available

Haif-07 avatar Aug 01 '24 01:08 Haif-07

Okay, but it's still a duplicate of that issue, and you can work around it by adding a .cargo/config.toml file with a single [env] line.

If what you mean is the following screenshot, it does not resolve the problem:

image


And the same as the previous comment, this in my case is not a cosmetic issue, since it make the plugin not functioning, not even giving hints for std stuffs. (I typed use s and nothing shows up`)

Da1sypetals avatar Aug 01 '24 02:08 Da1sypetals

@Da1sypetals

If what you mean is the following screenshot, it does not resolve the problem

Do you still get the same error message? I assume you did restart r-a or VS Code after creating the file.

What does RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/da1sypetals/.rustup/toolchains/stable-x86_64-unknown-linux-gnu" "/home/da1sypetals/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env" for your project?

image

I typed use s and nothing shows up

You need to press Ctrl-Space or type use std:: to trigger a completion there.

Anyway, please install the pre-release version (0.4.2057 or newer), that includes a fix for the cosmetic issue, and see if it works afterwards:

image

@Haif-07

Three months ago version available

Not sure what you mean, but you can also install the pre-release version.

lnicola avatar Aug 01 '24 05:08 lnicola

I've just experienced this bug with https://github.com/pop-os/libcosmic. I'm using Fedora 40

wiiznokes avatar Aug 02 '24 15:08 wiiznokes

Updating to our pre-release version resolves this issue. If there are other problems I would suggest opening a separate issue.

alibektas avatar Aug 02 '24 16:08 alibektas

@Da1sypetals what is the output of running the Show RA version command in VSCode?

To everone coming here regarding the env error, that one can be ignored it has no effect on anything.

Veykril avatar Aug 02 '24 16:08 Veykril