Skip to main content

Module syntax_validate

Module syntax_validate 

Source
Expand description

Post-edit syntax gate (#1008): a tree-sitter parse check used to reject an edit that turns a cleanly parsing file into a broken one.

Principle (plan Säule 3): only the clean → broken transition is a real regression. We never reject when the pre-edit file already had parse errors (the model may be fixing them), and we skip entirely for languages without a grammar — so the gate is a safety net, never an obstacle. The decision logic lives in gate_edit; check_syntax is the raw parse probe.

Structs§

SyntaxCheck
Outcome of a tree-sitter parse probe.

Functions§

check_syntax
Parse content as ext and report whether the tree has syntax errors.
gate_edit
The post-edit gate decision (#1008). Returns Some(reason) only for the clean → broken regression — the single case worth blocking — and None (allow the write) for every other situation: unsupported language, tree-sitter off, an already-broken pre-edit file, or a post-edit file that still parses.