Skip to content

feat(formatter): read each engine's grammar, add layout options and Vim tab commands - #3854

Merged
datlechin merged 13 commits into
mainfrom
feat/3850-switching-gaps
Oct 27, 2026
Merged

datlechin merged 13 commits into
mainfrom
feat/3850-switching-gaps

Conversation

@datlechin

@datlechin datlechin commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Format Query reads each engine's own quoting and comment rules, so it no longer changes what a statement means.
    • Kept intact: SQL Server [names], GO lines and Part#-style names; PostgreSQL $$ bodies, E'' and strings continued on the next line; MySQL # comments, DELIMITER and END$$; Oracle q'' and /; multi-character operators such as @>, +=, == and **; 0x and N'' literals.
    • Window ORDER BY, WITHIN GROUP, OUTER APPLY, calls in CREATE VIEW, columns named like keywords, nested CASE, subquery indent and HAVING.
    • Never creates a GO, DELIMITER or / line. A script with many GO batches formats in linear time.
    • A failure is shown instead of only logged.
  • Formatter settings: Clause items, AND and OR, and Data type case. Data type case applies only in type positions, and only on engines that fold type names.
  • SQLDialectDescriptor.typeNamesAreCaseInsensitive, set in every curated and plugin dialect whose engine folds type names (not ClickHouse). It is additive PluginKit API, so the kit is 41: v0.83.0 and v0.84.0-beta.1 shipped kit 40 from release branches.
  • check-pluginkit-abi.sh compares against the tag that shipped the highest kit, not the newest one HEAD reaches. plugin-system.md says the same.
  • .sql-formatter.json uses npm sql-formatter's keys for shared settings, and TablePro never writes a key that tool rejects. A file exported by 0.83 has to be exported again.
  • Vim:
    • gt, gT, {N}gt, :tabn, :tabp and :tabN switch tabs. A count past the last tab selects the last tab.
    • The "_ register writes nothing.
    • A huge tab count no longer crashes the app.
  • The editor gutter removes its selection observer, and redraws only for its own editor.
  • The PL/pgSQL and Oracle PL/SQL debugger from Gaps for switching from DataGrip: proven rewrites, app-wide Vim, formatter, PL/SQL debugger #3850 moves to its own pull request, on feat/3850-routine-debugger.
  • Not built, because the standard rules them out (lanes measured each):
    • Rewrites proven from the catalog: no parser in the app can prove a SELECT. The engines already apply the valid rewrites. NOT IN to NOT EXISTS needs both sides NOT NULL.
    • Modal Vim keys over the grid and sidebar: letters there are type-select, AppKit has no navigation commands to send, and the HIG keeps single keys to games.
  • Existing tests changed on purpose:
    • SQLFormatterRulesTests: the new file keys.
    • SQLFormatterServiceTests.windowFrameInline: now checks exact output; it used to pass on broken output.
    • SQLLexicalFeatureMappingTests: the app-curated T-SQL name fact.
    • SQLFormatterServiceTests.createTableColumnClauses: timestamp with time zone is one type now, so it keeps its typed spelling.

Test plan

  • New tests that fail on main:
    • Exact formatter output for each defect, plus statement boundaries kept across every layout and the 20,000-batch timing test.
    • Tokenizer cases, and a golden test pinning query fingerprints to main's on 74 queries.
    • Vim tab commands, overflow included, and the "_ register.
    • The gutter observer.
  • Unit plan, swift test on TableProSQLGrammar and TableProEditor, all plugins, verify.sh abi (changed against v0.84.0-beta.1, kit 41, minimum 19).

Screenshots

Before After
Formatter, light Formatter settings before Formatter settings with new options
Formatter, dark Formatter settings before, dark Formatter settings with new options, dark

Refs #3850

@datlechin datlechin changed the title feat(debugger): step through PL/pgSQL and PL/SQL, with formatter options and Vim tab commands feat(formatter): read each engine's grammar, add layout options and Vim tab commands Oct 27, 2026
@datlechin
datlechin enabled auto-merge (squash) October 27, 2026 07:36
@datlechin
datlechin merged commit 165c22b into main Oct 27, 2026
8 checks passed
@datlechin
datlechin deleted the feat/3850-switching-gaps branch October 27, 2026 11:00
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