You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sql): select the loaded formatter automatically - #191
SQL templates are left unformatted when only prettier-plugin-sql-cst is loaded and embeddedSqlPlugin is omitted. Select the loaded formatter by its parser capabilities, preferring prettier-plugin-sql when both are available.
Preserve explicit choices, per-tag overrides, the sqlite parser default, and existing embedded error handling. Add focused regression coverage, a README decision table, and a patch changeset.
Embedded SQL formatting now automatically selects an available SQL formatter when no formatter is explicitly chosen. If both supported formatters are loaded, prettier-plugin-sql is preferred; otherwise, the formatter that supports the configured SQL parser is selected.
An explicitly selected formatter continues to take precedence, with no fallback to another formatter.
Documentation
Updated the SQL formatter selection guide to explain selection rules and what happens when a parser is unavailable.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 6255c0bf-56ce-4502-8125-63ea54aff115
📥 Commits
Reviewing files that changed from the base of the PR and between 855308f and 7c03f55.
📒 Files selected for processing: 5
.changeset/tidy-sql-defaults.md
README.md
src/embedded/sql/embedder.ts
src/embedded/sql/options.ts
tests/embedded/sql.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
The SQL embedder now selects a formatter based on loaded parsers when embeddedSqlPlugin is unset. An explicit formatter choice remains in effect. Tests, README documentation, and a patch changeset cover the selection behavior.
Changes: SQL formatter selection
Layer / File(s)
Summary
Formatter resolution and validation src/embedded/sql/options.ts, src/embedded/sql/embedder.ts, tests/embedded/sql.spec.ts
The option no longer defaults to prettier-plugin-sql. When no formatter is specified, the embedder selects prettier-plugin-sql-cst if no plugin provides the sql parser and a plugin provides the configured parser, which defaults to sqlite. Otherwise, it selects prettier-plugin-sql. Tests cover plugin selection, output, and idempotence.
Selection documentation and changeset README.md, .changeset/tidy-sql-defaults.md
The README documents formatter selection, parser resolution, and missing-parser behavior. The changeset describes the formatter selection behavior.
The formatter-selection change is mergeable with normal checks; no blocking issue was established.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: automatic selection of a loaded SQL formatter when no formatter is specified.
Linked Issues check
For #187, src/embedded/sql/options.ts removes the fixed SQL plugin default. src/embedded/sql/embedder.ts preserves explicit embeddedSqlPlugin and embedded overrides, selects `prettier-plugin-sql…
Out of Scope Changes check
The changes stay within #187. The added tests verify formatter selection and preserved behavior. The README decision table documents the new selection rules. The patch changeset records the SQL format…
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Full details: Linked Issues check
Explanation
For #187, src/embedded/sql/options.ts removes the fixed SQL plugin default. src/embedded/sql/embedder.ts preserves explicit embeddedSqlPlugin and embedded overrides, selects prettier-plugin-sql-cst when no loaded plugin provides sql and the configured CST parser is available, and otherwise prefers prettier-plugin-sql. The sqlite default remains unchanged. Tests cover plugin order, explicit selection, tag overrides, idempotence, SQLite selection, and existing parser error handling.
Full details: Out of Scope Changes check
Explanation
The changes stay within #187. The added tests verify formatter selection and preserved behavior. The README decision table documents the new selection rules. The patch changeset records the SQL formatter fix. No unrelated implementation change is shown.
Full details: Docstring Coverage
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SQL templates are left unformatted when only
prettier-plugin-sql-cstis loaded andembeddedSqlPluginis omitted. Select the loaded formatter by its parser capabilities, preferringprettier-plugin-sqlwhen both are available.Preserve explicit choices, per-tag overrides, the
sqliteparser default, and existing embedded error handling. Add focused regression coverage, a README decision table, and a patch changeset.Validation:
pnpm test:ci: 1179 tests passed; coverage thresholds passed.pnpm checkpnpm type-checkgit diff --checkFixes #187.
Summary by CodeRabbit
New Features
prettier-plugin-sqlis preferred; otherwise, the formatter that supports the configured SQL parser is selected.Documentation