ek9_query_diagnostics
Answers first: diagnosticCount, errorCount, warningCount, errorCodes[] and sites[] ('file.ek9:LINE CODE message'), then diagnostics[] in full, byCode and byFile - the Problems View of the last compile.
When to use it
What is broken right now - every error and warning recorded by the last compile - one call, no arguments (fileFilter / severity / errorCode narrow it).
When not to use it
- One error code's WHY/QUICK FIX/EXAMPLE, not the current problem list — use
ek9_explain_error. - You want to TRIGGER a compile rather than read already-recorded diagnostics — use
ek9_compile(it produces diagnostics; this tool reads them). - You want build-state metadata (last outcome, freshness) rather than the diagnostics list — use
ek9_query_build_status. - You want TEST pass/fail results rather than COMPILE diagnostics — use
ek9_run_tests.
Details
Each diagnostic carries file (workspace-relative), line, column, severity, errorCode ('SYNTAX' for a parse error, which has no E-code), message (one line, no colour codes, no embedded explanation), typeOfError and classificationDescription, plus a richExplanation when the code has one; quickFixes and offendingSymbol are on by default while there are 20 diagnostics or fewer (pass the include* flag to force either way), fuzzySuggestions and tokenLength are opt-in, and codes with a mapped fix tool gain a remediation[] list. severity is all|errors|warnings, fileFilter is a path substring, and a filter matching nothing yields diagnostics:[] with zero counts — success, not an error. byCode and byFile count diagnostics (errors+warnings combined); no workspace returns {diagnostics:'unavailable', message:...}.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
errorCode | string | Optional specific error code filter (e.g., 'E05030') | |
fileFilter | string | Optional: keep only diagnostics whose file path contains this text | |
includeFuzzySuggestions | boolean | Include 'Did you mean?' fuzzy match suggestions per diagnostic. Default false. | |
includeOffendingSymbol | boolean | Include the likely-offending symbol name per diagnostic. Default: on while there are 20 diagnostics or fewer. | |
includeQuickFixes | boolean | Include actionable replacement suggestions extracted from parse errors and fuzzy matches. Default: on while there are 20 diagnostics or fewer. | |
includeTokenSpan | boolean | Include tokenLength for highlight rendering. Default false. | |
severity | string: all | errors | warnings | Severity filter: 'all' (default), 'errors', or 'warnings' |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Diagnostics shape
Request
{ }
Response
{
"byCode" : { },
"byFile" : [ ],
"diagnosticCount" : 0,
"diagnostics" : [ ],
"errorCodes" : [ ],
"errorCount" : 0,
"meta" : {
"serverMs" : "<timing>"
},
"sites" : [ ],
"warningCount" : 0
}
See also
- Fixes E11064
- Fixes E11065
- Part of the investigate_build_failure workflow: Diagnose dependency-resolution or compilation failure: diagnostics → tree → cycles → fix → re-resolve.