Skip to content

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

Open
datlechin wants to merge 5 commits into
mainfrom
feat/windows-completion-and-format
Open

datlechin wants to merge 5 commits into
mainfrom
feat/windows-completion-and-format

Conversation

@datlechin

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).
  • 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: 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 from nothing else.
  • 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.

Fixes #4275

… the core

The completion scope, catalog read, fuzzy ranking and formatter are copied from linux/crates/app into core; Linux moves onto them after its 0.1.0 tag (ROADMAP C-07, C-08).
…o numbers, rank a stale accept off the UI thread

This branch has not been deployed

No deployments
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