pub fn diagnose(
text: &str,
rope: &Rope,
variables: &BTreeMap<String, String>,
profile_name: Option<&str>,
) -> Vec<Diagnostic>Expand description
Parse text as SQL and return diagnostics for any parse errors and variable issues.
Resolves psql-style variables before parsing. Unresolved variables produce diagnostics at their position in the original text. Parse errors from the resolved SQL are mapped back to original-text positions via the substitution log.
§Arguments
text— The original SQL source text (as the editor shows it).rope— ARopebuilt from the sametext, used for byte-offset to line/column conversion.variables— Variable definitions from the project config.profile_name— Active profile name (if any), shown in undefined-variable messages. WhenNone, the diagnostic suggests setting a profile.
§Returns
A (possibly empty) vec of LSP diagnostics. Variable diagnostics are
WARNING if the file has the warn pragma, ERROR otherwise. Parse errors
are always ERROR.