Skip to main content

diagnose

Function diagnose 

pub fn diagnose(source: &str) -> Vec<Diagnostic>
Expand description

Best-effort single-file compilation that always returns diagnostics.

Used by the LSP server: lex → parse-with-recovery → resolve → check, with each phase accumulating its diagnostics. The returned SourceUnit is Some whenever the parser produced one (which is true for any file with a recognisable header, even if individual items failed). Resolve and check run only when both the lexer and parser produced a unit; their errors are added to the same diagnostic list.

The TypeScript output is intentionally not produced here — the LSP only needs diagnostics; the CLI uses compile / compile_project.