Skip to content

SQL Formatting / Prettier #23

Closed

Description

@debba

Add a configurable SQL formatter to standardize query syntax (case, indentation) within the editor.

Activity

  1. aesslinger commented on Jul 20, 2026

    @aesslinger
    Contributor

    Hey — I put together an implementation of this and wanted to check if you'd be open to a PR before submitting.

    What it does:

    • Registers a "Format SQL" action in the Monaco editor (Shift+Alt+F / Shift+Option+F)
    • Adds a toolbar button (WrapText icon) next to the Parameters button
    • Adds a right-click context menu entry
    • Supports formatting the full document or just the selection
    • Auto-detects dialect from the active connection via toFormatterLanguage()

    How it works:

    The sql-formatter package and formatSql() utility in src/utils/sqlFormat.ts already exist in the codebase — I just wired them into SqlEditorWrapper.tsx as a Monaco addAction (same pattern as the paste and run commands). The toolbar button in Editor.tsx triggers the same action.

    Diff is small: 3 files, ~70 lines. Passes pnpm typecheck and pnpm lint cleanly; existing sqlFormat.test.ts tests still pass.

    A few questions if you're interested:

    1. Would you prefer this as a user-configurable setting (keyword case, indent width, etc.) or is the current default (keywordCase: 'upper', 2-space indent) fine for a first pass?
    2. Any preference on the toolbar icon? I used WrapText from lucide-react but happy to change.
    3. Should I add the i18n key to all locale files, or do you handle that on your end?

    Happy to adjust the implementation to match your vision — just let me know.

  2. debba commented on Jul 20, 2026

    @debba
    CollaboratorAuthor

    Hi @aesslinger!
    Looks interesting .
    Can you open a PR if you already did it?
    We can discuss inside the PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestroadmapPart of the product roadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions