zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.7k stars 3.14k forks source link

rust-analyzer failed to run check or clippy command on rustc_private enabled files #20712

Open timurguvenkaya opened 1 week ago

timurguvenkaya commented 1 week ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Context:

with rustc_private

[toolchain]
channel = "nightly-2024-09-05"
components = [
    "cargo",
    "llvm-tools-preview",
    "rust-src",
    "rust-std",
    "rustc",
    "rustc-dev",
    "rustfmt",
]

regular crates

[toolchain]
channel = "stable"
components = ["rustfmt"]
targets = ["wasm32-unknown-unknown"]

.zed

{
"lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "rustc": {
          "source": "discover"
        }
      }
    }
  }
}

Issue:

Rust analyzer cannot run check/clippy command on files with rustc_private. Even if I have an error/warning, it is not displayed

Tried with VSCode with .vscode (same settings) -> works with no problem

VSCode shows a warning of unused import:

Screenshot 2024-11-15 at 11 11 11

Zed does not show any warning:

Screenshot 2024-11-15 at 11 12 40

However, when I move .zed to the crate folder and open the crate directly with zed (not the project root) -> everything works.

Environment

Zed: v0.161.2 (Zed) OS: macOS 15.0.1 Memory: 64 GiB Architecture: aarch64

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

No response

If applicable, attach your Zed.log file to this issue.

Zed.log 2024-11-15T10:45:08.584502+03:00 [INFO] found rust-analyzer in PATH. trying to run `rust-analyzer --help` 2024-11-15T10:45:08.63388+03:00 [INFO] found user-installed language server for rust-analyzer. path: "/Users/username/.cargo/bin/rust-analyzer", arguments: [] 2024-11-15T10:45:08.63406+03:00 [INFO] starting language server process. binary path: "/Users/username/.cargo/bin/rust-analyzer", working directory: "/Users/username/dev/some_project", args: [] 2024-11-15T10:45:13.741415+03:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/username/.cargo/registry/src/some_crate/src/lib.rs" 2024-11-15T10:45:12.840731+03:00 [WARN] Generic lsp request to rust-analyzer failed: content modified 2024-11-15T10:45:12.840861+03:00 [ERROR] inlay hint update task for range failed: Error { context: "inlay hint fetch task", source: Error { context: "inlay hints LSP request", source: "content modified", }, } 2024-11-15T10:45:13.741415+03:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/username/.cargo/registry/src/some_crate/src/lib.rs"
Language Server Log stderr: 2024-11-14T17:41:46.076389Z ERROR cyclic deps: some_crate(Idx::(0)) -> some_crate(Idx::(0)), alternative path: some_crate(Idx::(0))
notpeter commented 15 hours ago

Can you provide an example repo which demonstrates this issue so I can see if we can reproduce?