pub fn diagnostics_for_source(source: &str) -> Vec<Diagnostic>Expand description
Parses and type-checks adam-lang source, returning every recovered syntax and type error as
an LSP diagnostic.
- Postcondition: returns one [
Diagnostic] per [cel_parser::ParseError] recovered by [AdamAstParser::parse_str] (syntax errors, including the single error produced when the whole parse aborts instead of recovering one item) or returned by [check_sheet] (type errors); returns an emptyVecfor a syntactically and semantically clean sheet.
The environment explicitly includes the standard library and optional Euclid geometry, matching the executing web/book hosts. Unresolved call-result shapes remain best-effort.
- Complexity: O(n + s²) in source length and installed library signatures, with no caching.
§Examples
use adam_lsp::diagnostics::diagnostics_for_source;
assert!(diagnostics_for_source("sheet s { cell x: i32 = 1; }").is_empty());
assert_eq!(diagnostics_for_source("sheet s { cell x: i32 = 1.0; }").len(), 1);