Walker + parser: surface mid-typing after separators and Form C/A ambiguity
The typing-surface matrix exposed two bugs the existing 859-test suite missed: walk_repeated: when the separator consumed but the inner item failed at EOF, the old path rolled the separator back and reported a definite error at the rollback position (`insert into T (a, ` flashed red on the `,` after each comma). Now propagates Incomplete with the inner's expected set so the input renderer treats it as mid-typing. build_insert Form C path: `insert into T (col)` walked to a complete match but produced `values: []` because Form C's value collector drops ident-shaped items. The user almost certainly meant Form A and just hasn't typed `values (...)` yet. Reject with a ValidationError naming the Form-A continuation; classify_input now reports IncompleteAtEof. completion_probe / expected_at_input: ValidationFailed used to return an empty expected set, leaving Tab with nothing to offer at the new Form-A flag point. Now surface result.tail_expected (skipped-Optional expectations captured before validation fired) so `values` is still offered as a candidate.
This commit is contained in:
+16
-2
@@ -271,7 +271,14 @@ pub fn completion_probe(
|
||||
outcome::WalkOutcome::Match { .. } => result.tail_expected,
|
||||
outcome::WalkOutcome::Incomplete { expected, .. }
|
||||
| outcome::WalkOutcome::Mismatch { expected, .. } => expected,
|
||||
outcome::WalkOutcome::ValidationFailed { .. } => Vec::new(),
|
||||
// Validation failure path: the walker matched the
|
||||
// structural shape but the AST builder rejected (e.g.
|
||||
// Form C with column-shaped items). The walker still
|
||||
// captured the skipped-Optional expectations before the
|
||||
// validation fired — surface those so the user gets
|
||||
// useful Tab candidates even at a validation-flagged
|
||||
// position.
|
||||
outcome::WalkOutcome::ValidationFailed { .. } => result.tail_expected,
|
||||
};
|
||||
CompletionProbe {
|
||||
expected,
|
||||
@@ -324,7 +331,14 @@ pub fn expected_at_input(source: &str) -> Vec<outcome::Expectation> {
|
||||
outcome::WalkOutcome::Match { .. } => result.tail_expected,
|
||||
outcome::WalkOutcome::Incomplete { expected, .. }
|
||||
| outcome::WalkOutcome::Mismatch { expected, .. } => expected,
|
||||
outcome::WalkOutcome::ValidationFailed { .. } => Vec::new(),
|
||||
// Validation failure path: the walker matched the
|
||||
// structural shape but the AST builder rejected (e.g.
|
||||
// Form C with column-shaped items). The walker still
|
||||
// captured the skipped-Optional expectations before the
|
||||
// validation fired — surface those so the user gets
|
||||
// useful Tab candidates even at a validation-flagged
|
||||
// position.
|
||||
outcome::WalkOutcome::ValidationFailed { .. } => result.tail_expected,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user