Skip to content

rust-analyzer fails to provide diagnostics after 'rustlings lsp' (Windows 11) #1421

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
GersiD opened this issue Mar 12, 2023 · 3 comments
Closed

Comments

@GersiD
Copy link

GersiD commented Mar 12, 2023

------problem-statement----

After running rustlings lsp and setting cargo to use all features (for the exercise feature). Rust analyzer still fails to recognize the workspace and populate the exercises subdirectory with diagnostic information.

Please note that I still get Syntax Errors

---------env-info-----------

  • Neovim Version: v0.9.0-dev-1147+ge389b1890
  • cargo 1.66.0 (d65d197ad 2022-11-15)
  • rust-analyzer 1.68.0 (2c8cc343 2023-03-06)

-------what-I-tried--------

  1. Run rustligns lsp multiple times after re installing rustlings
  2. setting cargo. Features to "exercises"
  3. setting cargo.features to "all"
  4. updating rust
  5. updating rust-analyzer
  6. trying to see if VScode gets it
  7. manually adding the exercise subdir into the cargo.toml file with
[features]
default = ["exercises"]
exercises = []

None of the above worked :(

@GersiD
Copy link
Author

GersiD commented Mar 12, 2023

Please tell me what file I should use to test the diagnostics. Currently I am testing traits4.rs (because that's what I made it up to without the diagnostics).

@jnnnnn
Copy link

jnnnnn commented Mar 25, 2023

I spent a couple of hours trying to figure this out too (windows 10, the only weird thing about my rust installation is SCCACHE).

I ended up ditching the rust-project.json approach and generating mod files instead.

@GersiD
Copy link
Author

GersiD commented Mar 25, 2023

@jnnnnn Thank you! this works for rustlings files that are in directories but for things like quiz1,2,3 this solution does not work. I am working out now how to change it so that it works and then I will open a PR with you. Thank you!

Turns out I cannot open a PR with gists. So I forked it and added my changes, if you would like them as well.
https://gist.github.com/GersiD/9f1598cbcf436de56c2c16d88181efa6

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

2 participants