Skip to content

fix(query): surface traced diagnostics at main callsites - #2677

Open
GeronimoCastano wants to merge 1 commit into
Myriad-Dreamin:mainfrom
GeronimoCastano:fix/callsite-diagnostics
Open

fix(query): surface traced diagnostics at main callsites#2677
GeronimoCastano wants to merge 1 commit into
Myriad-Dreamin:mainfrom
GeronimoCastano:fix/callsite-diagnostics

Conversation

@GeronimoCastano

Copy link
Copy Markdown

Summary

When Typst reports an error inside an imported module or package, Tinymist assigns the primary LSP diagnostic to the internal source span and sends the user callsite through relatedInformation.

VS Code lists the diagnostic in the Problems panel, but Error Lens cannot display it beside the call that caused the error. Neovim clients have the same problem when they do not expose relatedInformation.

This change uses the outermost trace span in the main document as the displayed diagnostic location when the original error comes from another file. It keeps the original source location in relatedInformation with the message diagnostic originated here.

Diagnostics that originate in the main document keep their current location.

Tests

Added diagnostic fixtures covering:

  • an error raised in an imported file with a callsite in the main document;
  • an error raised directly in the main document.

Ran:

  • cargo test -p tinymist-query
  • cargo build -p tinymist-cli --release

Addresses #1870.

@GeronimoCastano
GeronimoCastano marked this pull request as ready for review July 28, 2026 23:20
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

Successfully merging this pull request may close these issues.

1 participant