Skip to content

feat(sql): schema-aware completion for db blocks via the LSP#34

Open
gandarfh wants to merge 1 commit into
mainfrom
feat/sql-schema-completion
Open

feat(sql): schema-aware completion for db blocks via the LSP#34
gandarfh wants to merge 1 commit into
mainfrom
feat/sql-schema-completion

Conversation

@gandarfh

Copy link
Copy Markdown
Member

Phase 3 of SQL support: the language server now offers context-aware SQL
completion inside ```db-* blocks (tables/columns from the app's cached
introspection), so completion is shared (desktop today, TUI later) instead
of reimplemented per surface.

  • Sql.complete ~tables ~text ~offset (pure): after FROM/JOIN/INTO/UPDATE ->
    table names; after a table. qualifier -> that table's columns; otherwise
    columns + tables; partial word matched case-insensitively; column detail
    carries the data type. Lexical context via the CST (last_keyword_before)
    so a half-typed tail still classifies.
  • Sql_schema_store.tables_for ~connection_id: reads the schema_cache
    table (connection id = the db-<conn> fence suffix), grouping rows into
    Sql.tables; degrades to [] on no-db / read error / cold cache.
  • on_completion: outside a {{ref}}, a db-* block falls back to SQL
    completion.
  • 6 pure completion tests; 146 pass, 0 fail.

No desktop change yet (it keeps its client-side completion); retiring
cm-db-schema-complete.ts lands with a later release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant