-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Overview
Add schema-aware autocomplete to the SQL editor, providing suggestions for table names, column names, SQL keywords, and functions as the user types.
Goals
- Fast, responsive autocomplete popup triggered by typing
- Schema-aware: suggest real table/column names from the connected database
- Keyword/function completion for SQL syntax
- Contextual suggestions (e.g., after
FROMsuggest tables, afterSELECTsuggest columns)
Proposed Behavior
Trigger
- Autocomplete popup appears automatically after typing 2+ characters
- Can also be manually triggered with
Ctrl+Space - Dismiss with
Esc
Suggestion Sources (priority order)
- Table names — from loaded schema (qualified:
schema.table) - Column names — from tables already referenced in the query
- SQL keywords —
SELECT,FROM,WHERE,JOIN, etc. - SQL functions —
COUNT(),JSONB_BUILD_OBJECT(), etc. - SQL types —
INTEGER,TIMESTAMPTZ,JSONB, etc.
Navigation
Up/Down— navigate suggestionsTaborEnter— accept suggestionEsc— dismiss popup- Continue typing to filter suggestions
Context Awareness
| After typing... | Suggest... |
|---|---|
FROM |
Table names |
JOIN |
Table names |
SELECT t. |
Columns of table aliased as t |
WHERE |
Column names from referenced tables |
:: |
Type names |
| Any partial word | Keywords, functions, tables matching prefix |
Implementation Suggestions
- Add
AutocompleteStatestruct toApp(active, suggestions list, selected index, filter text) - Build suggestion list from
app.tables,app.schemas,SQL_KEYWORDS,SQL_FUNCTIONS,SQL_TYPES - Render as a floating popup widget below the cursor position
- Use case-insensitive prefix matching for filtering
- Cache column lists per table to avoid repeated DB queries
UI Mockup
SELECT u.|
┌──────────────────┐
│ id INT4 │
│ name TEXT │
│ email TEXT │
│ created_at TSTZ │
└──────────────────┘
Definition of Done
- Autocomplete popup renders correctly below cursor
- Table and column names from schema appear as suggestions
- SQL keywords and functions appear as suggestions
- Typing filters the list in real-time
- Tab/Enter inserts the selected suggestion
- Esc dismisses the popup
- No noticeable input lag when popup is active
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels