Skip to content

Fix: "skipping diagnostics update, no worktree found” / “URI is not a file" errors in Zed #17

@0xpantera

Description

@0xpantera

What Cairo-LS emits

  • Cairo-LS doesn’t limit itself to the files that are in the user’s project directory.
  • During analysis it also walks std-lib sources (downloaded into Scarb’s cache) and crate-dependencies pulled from registry/src/....
  • For every file it analyses it may publish diagnostics:
{
  "method": "textDocument/publishDiagnostics",
  "params": {
    "uri": "file:///Users/…/Library/Caches/com.swmansion.scarb/registry/std/v2.11.4/core/src/panics.cairo",
    "diagnostics": [ ]
  }
}

or, when the file is kept only in memory, using Cairo-LS’s virtual-file-system URIs:
vfs://1234/embeddable.cairo

How current Zed reacts

Zed’s LSP layer assumes that every URI it gets back:
1. either points to a real file inside the work-tree that the user opened, or
2. is one of its own in-memory buffers.

If the URI fails both checks Zed logs:

WARN  skipping diagnostics update, no worktree found for path …
ERROR URI is not a file

and simply discards the diagnostics.
Nothing is actually broken, the warnings only mean “I’m ignoring that diagnostic because I don’t know where to show it”.

I couldn't find if Zed allows extensions to register external / virtual files and surface their diagnostics in secondary panels (much like VS Code does).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions