Skip to content

Too many same issues reported in problem console by rust-analyzer in vscode remote server mode #14602

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

Closed
cokeBeer opened this issue Apr 18, 2023 · 14 comments
Labels
C-bug Category: bug

Comments

@cokeBeer
Copy link

rust-analyzer version: rust-analyzer version: 0.3.1481-standalone

rustc version: rustc 1.65.0 (897e37553 2022-11-02)

relevant settings: None

image

I am using vscode remote server mode with rust-analyzer. Too many same issues.

@cokeBeer cokeBeer added the C-bug Category: bug label Apr 18, 2023
@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

Are you using a VS Code workspace?

@cokeBeer
Copy link
Author

Yes

@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

We currently run cargo check on each workspace member, and there's no easy way to avoid it. I suggest going for a plain Cargo workspace if possible.

@cokeBeer
Copy link
Author

So why the issues are same ? Seems one file is checked many times and reported.

@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

If I understand correctly, on a Code workspace with library L and projects A and B, both depending on it, we'll run cargo check three times, for each crate.

So if L has an error, we'll report it once for L, once for A and once for B. Three times.

@cokeBeer
Copy link
Author

No, the issue comes from mod.rs, which is only used in this project and the issue is reported 5 times. (Are you talking about cargo workspace with many members instead of vscode workspace ? I mean, I am opening the folder as vscode workspace. )

@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

Well, I don't know, and it might be hard to tell without a sample project showing the problem.

@cokeBeer
Copy link
Author

cokeBeer commented Apr 18, 2023

@lnicola The comand ps -ef|grep rust shows there are 5 rust-analyzer and the number is the same as issues. Does it help ?

ubuntu    4970 19529 99 18:29 ?        00:01:42 /home/ubuntu/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1481-linux-x64/server/rust-analyzer
ubuntu    5061  4970  0 18:29 ?        00:00:00 /home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv
ubuntu    5063  4970  0 18:29 ?        00:00:00 /home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv
ubuntu    5065  4970  0 18:29 ?        00:00:00 /home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv
ubuntu    5067  4970  0 18:29 ?        00:00:00 /home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv
ubuntu    5069  4970  0 18:29 ?        00:00:00 /home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv

@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

I think there's a discussion of a similar issue under #13954 (comment).

Five rust-analyzer-proc-macro-srv instances indicates you have a Code workspace with five members. You're also getting an error duplicated five times. It's likely that these are related.

@cokeBeer
Copy link
Author

@lnicola Hi, I've read that issue now. However, I only open one workspace as it mentioned above and the project is standalone and has no members. So maybe I am not matching the situation in #13954. But I can provide some additional information that, the standalone project is a sub folder under a git repo, like

git_repo_root
-- my_rust_project
-- my_java_project
-- my_c_project

All other projects are not written in rust. If I open the folder git_repo_root directly, the number of issues and rust-anaylzer is right ( only 1 ).
Maybe the problem is associated with git ?

@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

Do you have a Cargo.toml under git_repo_root?

@cokeBeer
Copy link
Author

cokeBeer commented Apr 18, 2023

No, only a Cargo.toml under my_rust_project

[package]
name = "fuzzer"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libafl = { git = "https://github.com/AFLplusplus/LibAFL.git", rev = "0727c80" }
reqwest = { version = "0.11.13", features = ["blocking"] }
tokio = { version = "1", features = ["full"] }
bytes = "1.3.0"
clap = { version = "4.1.8", features = ["derive"] }
syscalls = "0.6.7"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
url = "2.3.1"

@cokeBeer
Copy link
Author

@lnicola Hi, I see. This is my my_rust_project/.vscode/settings.json. I don't know why but there are 5 Cargo.toml in it.

{
    "rust-analyzer.linkedProjects": [
        "./Cargo.toml",
        "./Cargo.toml",
        "./Cargo.toml",
        "./Cargo.toml",
        "./Cargo.toml"
    ],
    "rust-analyzer.showUnlinkedFileNotification": false
}

After I delete them, everything is ok. Thanks for your help.

@lnicola
Copy link
Member

lnicola commented Apr 18, 2023

Right. There's was a bug where we asked about adding new projects there, and took No for a yes, and the other way around 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants