Tab completion: offer common SQL function names in expression positions #15

Closed
opened 2026-05-28 23:03:42 +01:00 by oliversturm · 1 comment
oliversturm commented 2026-05-28 23:03:42 +01:00 (Migrated from github.com)

At select (and any other sql_expr_ident slot — WHERE, projections, HAVING, etc.) Tab cycles through schema columns plus a handful of expression keywords (null, distinct, not, true, false, exists, case, …). It does not offer common SQL function names.

After the function-call validator fix landed, the user can type sum/avg/etc. without false flagging, but they have to know the function names already. Pedagogically this is the next step: surface them as candidates so the user can discover them.

Scope to settle

  • Which functions? Aggregates (sum/avg/count/min/max) are the obvious first set. Likely also common scalars (length, upper, lower, coalesce, abs, round, trim, substr). A curated pedagogical set, not "every SQLite built-in".
  • Display kind? A new CandidateKind::Function could give them a distinct colour in the panel (same machinery the keyword/identifier kinds already use).
  • Prefix matching? Same prefix-match rule as keywords.
  • Trigger context? Only at sql_expr_ident positions (the walker tags this via the expected set already used in candidates_at_cursor_in_mode).

Related

  • Surfaced during the /runda round on the function-call validation fix.
  • Pairs naturally with the parallel ticket on "restore typing-time column-typo hint via known-function list" — both want the same curated list.
At `select ` (and any other `sql_expr_ident` slot — WHERE, projections, HAVING, etc.) Tab cycles through schema columns plus a handful of expression keywords (`null`, `distinct`, `not`, `true`, `false`, `exists`, `case`, …). It does **not** offer common SQL function names. After the function-call validator fix landed, the user can type `sum`/`avg`/etc. without false flagging, but they have to know the function names already. Pedagogically this is the next step: surface them as candidates so the user can discover them. ### Scope to settle - **Which functions?** Aggregates (sum/avg/count/min/max) are the obvious first set. Likely also common scalars (length, upper, lower, coalesce, abs, round, trim, substr). A curated pedagogical set, not "every SQLite built-in". - **Display kind?** A new `CandidateKind::Function` could give them a distinct colour in the panel (same machinery the keyword/identifier kinds already use). - **Prefix matching?** Same prefix-match rule as keywords. - **Trigger context?** Only at `sql_expr_ident` positions (the walker tags this via the expected set already used in `candidates_at_cursor_in_mode`). ### Related - Surfaced during the /runda round on the function-call validation fix. - Pairs naturally with the parallel ticket on "restore typing-time column-typo hint via known-function list" — both want the same curated list.
oliversturm commented 2026-06-02 15:40:39 +01:00 (Migrated from github.com)

Resolved by ADR-0022 Amendment 6 (commit 6d8c9ee): a curated KNOWN_SQL_FUNCTIONS list (src/dsl/sql_functions.rs) offers common SQL function names as Tab candidates (CandidateKind::Function, new tok_function colour) at expression positions. See docs/handoff/20260602-handoff-53.md.

Resolved by ADR-0022 Amendment 6 (commit 6d8c9ee): a curated KNOWN_SQL_FUNCTIONS list (src/dsl/sql_functions.rs) offers common SQL function names as Tab candidates (CandidateKind::Function, new tok_function colour) at expression positions. See docs/handoff/20260602-handoff-53.md.
Sign in to join this conversation.