Hint: pedagogical Form-A pointer at Form B's first value slot

Handoff-12 §2.2: Form B `insert into T values (…)` silently skips
auto-generated columns from the value list, so a user who wants to
set a serial/shortid column explicitly could only discover Form A by
reading help. Now the hint at the first Form B value slot appends a
note naming the skipped column(s) and pointing at the explicit-column
form.

hint_resolution_at_input derives the skipped columns from the
post-walk WalkContext (Form B = no user_listed_columns + table has
serial/shortid columns) and reports them on HintResolution; the note
fires only at the first slot so it doesn't repeat at every comma.
ambient_hint composes it onto the per-column prose.
This commit is contained in:
claude@clouddev1
2026-05-15 21:30:03 +00:00
parent bcc5ad2f20
commit f1ff5970bf
12 changed files with 366 additions and 33 deletions
+21 -1
View File
@@ -237,7 +237,8 @@ pub fn ambient_hint(
// candidate completion (e.g. `n` → `null`) applies.
if cursor_partial_is_empty(input, cursor) {
let detail = crate::friendly::translate(key, &[]);
let composed = match resolution.and_then(|r| r.column) {
let resolution = resolution.expect("matched on resolution.mode");
let mut composed = match resolution.column {
Some(column) => crate::t!(
"hint.value_slot_for_column",
column = column,
@@ -245,6 +246,25 @@ pub fn ambient_hint(
),
None => detail,
};
// Form B pedagogical note: when the first value
// slot of `insert into T values (…)` is reached
// and T has auto-generated columns the value list
// skips, point the user at the explicit-column
// form so the skipped column is discoverable
// (handoff-12 §2.2).
if !resolution.form_b_autogen_skipped.is_empty() {
let columns = resolution
.form_b_autogen_skipped
.iter()
.map(|c| format!("`{c}`"))
.collect::<Vec<_>>()
.join(", ");
composed.push(' ');
composed.push_str(&crate::t!(
"hint.value_slot_autogen_skipped",
columns = columns
));
}
return Some(AmbientHint::Prose(composed));
}
}