Skip to content

rust lsp bug: code greyed out & 'file not included in crate hierarchy' #12847

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
1 task done
extrawurst opened this issue Jun 10, 2024 · 9 comments
Closed
1 task done
Labels
bug [core label] language server failure Language server doesn't work as expected language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors rust Rust programming language support

Comments

@extrawurst
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Closed source, so i cannot share a simple reproduction.
I just know the same project structure works fine in vscode with rust-analyzer. zed since today suddenly stoped working.

Environment

Zed: v0.139.3 (Zed Preview)
OS: macOS 14.5.0
Memory: 64 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

Screenshot 2024-06-10 at 16 22 26

I expect to see normal syntax highlighting and code completion

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

[....]
2024-06-10T16:11:17+02:00 [INFO] starting language servers for Rust: rust-analyzer
2024-06-10T16:11:17+02:00 [INFO] starting language server "rust-analyzer", path: "/Users/stephan/code/rustunit/tinytakeoff", id: 5
2024-06-10T16:11:17+02:00 [ERROR] crates/project/src/project.rs:7312: oneshot canceled
2024-06-10T16:11:17+02:00 [ERROR] crates/project/src/project.rs:7312: oneshot canceled
2024-06-10T16:11:17+02:00 [ERROR] crates/editor/src/editor.rs:4443: oneshot canceled
2024-06-10T16:11:17+02:00 [ERROR] crates/project/src/project.rs:7312: oneshot canceled
2024-06-10T16:11:17+02:00 [ERROR] crates/editor/src/editor.rs:4443: oneshot canceled
2024-06-10T16:11:17+02:00 [INFO] starting language server. binary path: "/Users/stephan/Library/Application Support/Zed/languages/rust-analyzer/rust-analyzer-2024-06-10", working directory: "/Users/stephan/code/rustunit/tinytakeoff", args: []
2024-06-10T16:11:17+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 0}, offset: 0, bias: Left, buffer_id: None }..Anchor { timestamp: Lamport {0: 1}, offset: 350, bias: Right, buffer_id: Some(BufferId(167503724711)) } failed: inlay hint fetch task: inlay hints LSP request: oneshot canceled
2024-06-10T16:11:17+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 0}, offset: 0, bias: Left, buffer_id: None }..Anchor { timestamp: Lamport {0: 1}, offset: 394, bias: Right, buffer_id: Some(BufferId(4294967375)) } failed: inlay hint fetch task: inlay hints LSP request: oneshot canceled
2024-06-10T16:11:43+02:00 [INFO] Initializing default prettier with plugins {}
2024-06-10T16:11:43+02:00 [INFO] starting language servers for Rust: rust-analyzer
2024-06-10T16:11:44+02:00 [INFO] Initializing default prettier with plugins {}
2024-06-10T16:11:44+02:00 [INFO] starting language servers for TOML: taplo
2024-06-10T16:22:38+02:00 [ERROR] Cancelled LSP request task for "textDocument/inlayHint" id 19 which took over 120s
2024-06-10T16:22:38+02:00 [WARN] Generic lsp request to rust-analyzer failed: LSP request timeout
2024-06-10T16:22:38+02:00 [ERROR] Cancelled LSP request task for "textDocument/codeAction" id 21 which took over 120s
2024-06-10T16:22:38+02:00 [WARN] Generic lsp request to rust-analyzer failed: LSP request timeout
2024-06-10T16:22:38+02:00 [ERROR] crates/project/src/project.rs:7312: LSP request timeout
2024-06-10T16:22:38+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 1}, offset: 492, bias: Left, buffer_id: Some(BufferId(4294967374)) }..Anchor { timestamp: Lamport {0: 1}, offset: 983, bias: Right, buffer_id: Some(BufferId(4294967374)) } failed: inlay hint fetch task: inlay hints LSP request: LSP request timeout
@extrawurst extrawurst added admin read bug [core label] labels Jun 10, 2024
@Moshyfawn Moshyfawn added rust Rust programming language support language An umbrella label for all programming languages syntax behaviors language server failure Language server doesn't work as expected language server An umbrella label for all language servers and removed triage labels Jun 10, 2024
@extrawurst
Copy link
Author

ok no it also does the same now in vscode when using the release of today, maybe due to rust-lang/rust-analyzer#17378. downgrading RA in vscode from v0.3.1992 to v0.3.1983 is a workaround. how can I pick the RA version in ZED?

@lnicola
Copy link

lnicola commented Jun 10, 2024

Do you have a mod api declaration in the parent module?

@extrawurst
Copy link
Author

this applies to every file in my project and yes of course this module is actually in the hierarchy, this module did not change and as stated above it must be related to the RA version v0.3.1992 (which I assume zed updated to today for me) because it also fails in vscode with that and going back to RA v0.3.1983 brings back everything as expected in vscode.

so its clearly a problem in RA.

still I would love to know how to forcefully set/downgrade the RA version in zed as in this state zed is basically bricked for me

@lnicola
Copy link

lnicola commented Jun 10, 2024

This was caused by rust-lang/rust-analyzer#17350. But it doesn't make RA emit a new warning, it just makes the span bigger, because the warning wasn't noticeable enough. Please make sure that there aren't any missing module declarations on the path to api, and file a RA issue if you're sure it's a bug.

You can delete most files from your projects and most code from the remaining files. It doesn't need to build or run.

@extrawurst
Copy link
Author

extrawurst commented Jun 10, 2024

Please make sure that there aren't any missing module declarations on the path to api, and file a RA issue if you're sure it's a bug.

can you specify what you mean? the files are work and are actually in the build when I use cargo.

i suspected maybe the fact that I have this workspace structure where I have a main.rs and a lib.rs to maybe now breaking RA, so I tested against bevy_game_template this version which was used as a template for my project here.

and indeed it breaks RA and triggers this: rust-lang/rust-analyzer#17376

I find the same error in the lang server logs in zed. strangely though the same does not happen in my project causing the issues here

@mrnugget
Copy link
Member

I'm also running into this as of today. It goes away once rust-analyzer has fully loaded the repository. Seems like an upstream change.

still I would love to know how to forcefully set/downgrade the RA version in zed as in this state zed is basically bricked for me

You can configure the binary manually in your Zed settings.json:

{
  "lsp": {
    "rust-analyzer": {
      "binary": {
        "path": "/Users/thorstenball/tmp/rust-analyzer-aarch64-apple-darwin" // <-- must be absolute path
      }
    }
  }
}

@lnicola
Copy link

lnicola commented Jun 11, 2024

@extrawurst see also rust-lang/rust-analyzer#17386.

@extrawurst
Copy link
Author

yeah and that one is caused by: rust-lang/rust-analyzer#17378

@extrawurst
Copy link
Author

I can report that zed with the new rust-analyzer release 0.3.1995 works again for me. see rust-lang/rust-analyzer#17378 (comment).

will close this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] language server failure Language server doesn't work as expected language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors rust Rust programming language support
Projects
None yet
Development

No branches or pull requests

5 participants