Skip to content

feat(windows): SQL completion and Format query in the editor, through the core - #4401

Merged
datlechin merged 7 commits into
mainfrom
feat/windows-completion-and-format
Nov 21, 2026
Merged

datlechin merged 7 commits into
mainfrom
feat/windows-completion-and-format

Conversation

@datlechin

@datlechin datlechin commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Core: tablepro_core::sql_syntax::completion (caret scope, fuzzy ranking, word start) and sql_syntax::format (the formatter, with caret mapping and selection formatting), and tablepro_session::completion::read_catalog. These are copies of the Linux app's completion_scope.rs, fuzzy.rs, catalog_read.rs, format_plan.rs and significant_tokens.rs. linux/ is not touched: Linux moves onto them after its 0.1.0 tag (ROADMAP C-07, C-08).
  • The core copies fix what the Linux code still gets wrong: the formatter keeps psql's COPY ... FROM stdin rows and backslash lines as typed, and keeps a statement as typed unless its tokens hold under both backslash readings (MySQL NO_BACKSLASH_ESCAPES). A subquery's alias shadows an outer one, a table may take an unreserved keyword (count), and a number or a name joined by $ completes nothing.
  • FFI: DatabaseSession::complete(text, caret, asked, database) returns a CompletionList that ranks again for each word typed. format_sql and format_sql_selection are free functions. Bindings are regenerated.
  • Windows editor: completion in a Popup with a ListView that never takes focus. It opens 50 ms after a letter, or after a space, comma, dot or ( where the place takes a name. Ctrl+Space opens it anywhere. Up, Down, Page Up, Page Down, Enter, Tab and double click work, and with Vim on these keys reach the list before Vim. The editor raises a UIA notification for the selected row.
  • Windows editor: Enter takes a row only when it changes the word typed, otherwise it breaks the line (VS Code's smart Enter), so FROM Track then Enter starts a new line. Tab always takes the row.
  • Windows editor: Format query (Query menu, editor menu, Ctrl+Shift+F) formats the selection, or the whole text when nothing is selected. It is one undo step that replaces only the changed part.
  • A tab in another database completes from that database where the catalog lists it as a schema (MySQL), and offers only keywords where the catalog does not describe it.
  • ADRs: Windows 0002 (Completion and format, keys), 0004 (keys), 0007 and 0011 (stale "no completion" lines); core/ARCHITECTURE.md, Bindings; windows/AGENTS.md.

Test plan

  • Rust: scope, fuzzy, ranking, word, formatter and caret mapping tests in tablepro-core, catalog home tests in tablepro-session, and in tablepro-ffi the UTF-16 offsets, keyword casing and a real SQLite file (tables, quoted names, alias columns, another database).
  • C#: CompletionTests (interop against SQLite and the formatter), ReplaceTests (editor model).
  • UI: CompletionOffersTheCatalogAndTakesTheChosenName, FormatQueryReflowsTheTextAsOneUndoStep and FormatQueryReflowsTheSelectionAloneFromTheQueryMenu, in light and dark, with screenshots 188 to 191.

Screenshots from the x64 UI tests:

Tables after FROM, light
An alias's columns, dark
Format query on a selection, light
Format query on the whole text, dark

Fixes #4275

@datlechin
datlechin merged commit 2f3345f into main Nov 21, 2026
48 checks passed
@datlechin
datlechin deleted the feat/windows-completion-and-format branch November 22, 2026 00:38
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.

Windows: editable results and SQL completion

1 participant