Skip to content

rust-analyzer not integrating with rustlings using VSCode in Windows #1525

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
dehanjl opened this issue May 22, 2023 · 7 comments
Closed

rust-analyzer not integrating with rustlings using VSCode in Windows #1525

dehanjl opened this issue May 22, 2023 · 7 comments

Comments

@dehanjl
Copy link

dehanjl commented May 22, 2023

I am having an issue similar to the issues described here: rust-lang/rust-analyzer#12235 and here rust-lang/rust-analyzer#4894.

So I tried this on multiple machines:

  • Machine A: Windows, Rust using MSVC, VSCode
  • Machine B: Windows, Rust on WSL, VSCode using WSL Extension, rust-analyzer running in WSL.
  • Machine C: MacOS, Rust installed natively, VSCode.

On both windows machines, rust-analyzer does not seem to be integrating nicely with the rustlings repo. For example, syntax checking is not working. However, on the mac, everything seems to be fine.

For all three machines, the project was opened in the rustlings root directory, and rustlings lsp was ran. However, the windows machines still did not seem to play nice.

I was using the following versions:

  • rustc 1.69.0 (84c898d65 2023-04-16)
  • rustlings v5.5.1
@manyinsects
Copy link
Member

Which version of the rust-analyzer VSCode plugin are you using?

@dehanjl
Copy link
Author

dehanjl commented May 22, 2023

Which version of the rust-analyzer VSCode plugin are you using?

Machine B & C: v0.3.1524

@manyinsects
Copy link
Member

Hm, that's super strange, and your rust-project.json shows relative paths? I'm really not sure why it wouldn't work if you're using a r-a version that includes the upstream path fix

@dehanjl
Copy link
Author

dehanjl commented May 22, 2023

My rust-project-json looks something like this (on Machine B):

{
    "sysroot_src": "/home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library",
    "crates": [
        {
            "root_module": "exercises/clippy/clippy1.rs",
            "edition": "2021",
            "deps": [],
            "cfg": [
                "test"
            ]
        },
...

I suspect it might have something to do with the rust-analyzer extension as when I reload it on one of the Windows machines, it says "indexing 1/5", while on the Mac it says "indexing 1/10". Almost like the Mac is picking up dependencies whereas the windows machine is not. For me it's really peculiar that this is happing both using MSVC and WSL.

@manyinsects
Copy link
Member

Could you open an issue on r-a referencing this one, maybe? They might be able to figure out what's happening here, because I don't think (= hope) it's because of what's happening on our end.

@Veykril
Copy link
Member

Veykril commented Jun 29, 2023

Just spotted this randomly (there was no new r-a issue opened afaik). Latest rustlings repo + latest r-a nightly works for me just fine on nightly on my windows machine. Could you post an entry of the rust-project.json from your windows machine maybe?

@mo8it
Copy link
Contributor

mo8it commented Mar 30, 2024

Closing because @Veykril verified that it works :)

The whole class of such issues might just disappear when we use Cargo.toml instead of rust-project.json as described in #1935

@mo8it mo8it closed this as completed Mar 30, 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

4 participants