Advanced-mode create table T ( suggests table-level constraints before suggesting a column name
#4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observed
After
create table Orders (, the completion hints suggest:primary,unique,check,constraint,foreign…before any hint for a column name. The dominant case at this position is "now type a column name"; table-level constraints are the rarer follow-up.
Why
ELEMENT_CHOICESinsrc/dsl/grammar/sql_create_table.rs:391lists the choices in this order:The first five start with reserved keywords and so surface as concrete literal candidates;
COLUMN_DEFstarts withCOL_NAME(anIdent/NewNamerole) — a less concrete "type something" hint — so it ranks last in the displayed list.Expected
A column name (the
COLUMN_DEFfirst move) should be the prominent suggestion. Table-level constraints can still appear, but they shouldn't crowd out the most common next step. Possible fixes: reorder the choices, weight ident roles higher in hint rendering, or split into "column name (most common)" vs "or constraint:" groupings.Resolved in commit
6f87ad1.Added a new
HintMode::IntroProse(&'static str)variant that surfaces catalog prose at slot entry without suppressing Tab completion (unlikeProseOnly) and without requiringtyping_name_at_cursorto fire (unlikeForceProse). Wrapped ELEMENT inNode::Hinted { mode: IntroProse("hint.create_table_element"), … }.At
create table T (the ambient hint now reads: "Type a column name, or a table-level constraint:primary,unique,check,constraint,foreign" — column name is the dominant first move; the constraint alternatives are folded into the prose. Tab still cycles every keyword.The new variant is an additive extension to the ADR-0024 HintMode-per-node model; no behaviour change to existing modes.