Advanced-mode CREATE TABLE: double shown as a separate type literal; full type list only appears after a trailing space #5

Closed
opened 2026-05-28 14:44:06 +01:00 by oliversturm · 1 comment
oliversturm commented 2026-05-28 14:44:06 +01:00 (Migrated from github.com)

Observed

Typing create table Orders (count (advanced mode), the hint reads:

Next: `double` or type

…with double listed as if it were peer to the rest of the type role. After adding one more space (create table Orders (count ), the full type list appears as expected.

Adding the trailing space is the workaround; the column name itself isn't what's coupling the hint — any partial ident at that position produces the same text.

Why

SQL_TYPE is a Choice between two branches (src/dsl/grammar/sql_create_table.rs:88):

DOUBLE_PRECISION_NODES = [Word("double"), Word("precision")]
TYPE_WITH_LENGTH_NODES = [type-name ident, optional length]

The two-word alias double precision was given a dedicated branch (per the comment, so the per-word Ident validator never has to make sense of double on its own). The completion-probe surfaces both branches' leading tokens: the literal double from the first branch, and the type-name ident role from the second.

Expected

Either:

  • Fold the double precision form into the regular type list so the hint renders a single coherent "type" suggestion, or
  • Improve hint synthesis so a two-word alias branch is collapsed into the ident-role hint rather than dangling as a peer literal.

Related to

The other two advanced-mode CREATE TABLE completion bugs (filed separately):

  • the ( continuation not being suggested
  • table-level constraints appearing before column-name suggestions
### Observed Typing `create table Orders (count` (advanced mode), the hint reads: > Next: \`double\` or type …with `double` listed as if it were peer to the rest of the type role. After adding one more space (`create table Orders (count `), the full type list appears as expected. Adding the trailing space is the workaround; the column name itself isn't what's coupling the hint — any partial ident at that position produces the same text. ### Why `SQL_TYPE` is a `Choice` between two branches (`src/dsl/grammar/sql_create_table.rs:88`): ```rust DOUBLE_PRECISION_NODES = [Word("double"), Word("precision")] TYPE_WITH_LENGTH_NODES = [type-name ident, optional length] ``` The two-word alias `double precision` was given a dedicated branch (per the comment, so the per-word `Ident` validator never has to make sense of `double` on its own). The completion-probe surfaces both branches' leading tokens: the literal `double` from the first branch, and the type-name ident role from the second. ### Expected Either: - Fold the `double precision` form into the regular type list so the hint renders a single coherent "type" suggestion, or - Improve hint synthesis so a two-word alias branch is collapsed into the ident-role hint rather than dangling as a peer literal. ### Related to The other two advanced-mode CREATE TABLE completion bugs (filed separately): - the `(` continuation not being suggested - table-level constraints appearing before column-name suggestions
oliversturm commented 2026-05-28 20:01:36 +01:00 (Migrated from github.com)

Resolved in commit 6f87ad1.

Added ("double", "double precision") to COMPOSITE_CANDIDATES and extended the keyword filter to drop composite openers, so the composite phrase replaces the bare opener instead of appearing alongside it. Tab now offers double precision as a single coherent candidate; bare double no longer appears alongside int/text/etc. in the regular type list.

The partial-typing prose case (create table T (count, no trailing space) is subsumed by #4's IntroProse: while mid-typing the user reads "Type a column name…", then advances to the clean type list once the column name resolves.

Resolved in commit 6f87ad1. Added `("double", "double precision")` to `COMPOSITE_CANDIDATES` and extended the keyword filter to drop composite openers, so the composite phrase replaces the bare opener instead of appearing alongside it. Tab now offers `double precision` as a single coherent candidate; bare `double` no longer appears alongside `int`/`text`/etc. in the regular type list. The partial-typing prose case (`create table T (count`, no trailing space) is subsumed by #4's IntroProse: while mid-typing the user reads *"Type a column name…"*, then advances to the clean type list once the column name resolves.
Sign in to join this conversation.