Completions popup

Floating popup that ranks candidates from the identifier cache and the SQL keyword list against the word under the cursor. Up/Down navigates; Tab or Enter commits the highlight.

Category: repl-features

Description

## Overview The completions popup is the SQL-aware autocomplete surface of the interactive shell. It is triggered when the input is a SQL buffer (not slash-prefixed), there is a word under the cursor, and a non-empty set of candidates can be ranked for that position. Candidates combine identifiers from the shared `IdentifierCache` and keyword / type / function / snippet entries from `delta_forge_lang::completions`. ## Behavior - Visibility rule (`completions::should_show`): buffer is non-empty and does not start with `/` or `:`. The popup then renders above the input island, clipped to the terminal width and capped at 8 visible rows. - Context classifier (`word_at_cursor`): the token immediately before the cursor selects the scoring bias. - After `FROM`, `JOIN`, `TABLE`, `INTO`, or `UPDATE`: tables are boosted by +1000 so they sort ahead of keywords. - After a dot qualifier (`left.` where `left` is one or more identifier segments): the classifier tries, in order, (1) treat `left` as a fully-qualified table and emit its columns, (2) treat `left` as a partial qualifier (`zone` or `zone.schema`) and emit matching suffixes from the tables set, (3) resolve `left` as a FROM-clause alias via `delta_forge_lang::aliases` and emit that table's columns. - Anywhere else: keywords dominate but matching table names still surface with a modest base score. - Empty prefix + `General` context suppresses the popup entirely so an idle buffer is not cluttered. Empty prefix **with** a FROM / dot context does show it, which catches the common `select * from ` pattern. - Fuzzy scoring: exact > prefix > substring > subsequence. Subsequence score rewards tight character packing. Candidates are rendered `label | kind-short | detail` where kind is `kw`, `type`, `snip`, `fn`, `tbl`, or `col`. - Commit: Tab or Enter (without Shift) splices the selected candidate over the word under the cursor and places the cursor at the end of the inserted label. ## Interaction - Navigation (Up/Down) wraps within the visible slice (top 8 rows). - Typing any alphanumeric character or Backspace/Delete resets the highlight to the top candidate, matching the behaviour of the slash menu. - When the popup is suppressed (slash context, empty context), Tab falls through to the slash menu's tab-complete or is consumed as a no-op. Shift+Enter always inserts a newline; Ctrl+Enter always submits regardless of the popup. ## Compatibility - `--classic` uses a reedline columnar menu over the static SQL keyword list only. It has no access to the identifier cache and no context classifier, so it will not suggest table or column names.

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →