feat: #206 add configurable SQL formatting with formatSQL API - #226
Open
Cythia828 wants to merge 1 commit into
Open
feat: #206 add configurable SQL formatting with formatSQL API#226Cythia828 wants to merge 1 commit into
Cythia828 wants to merge 1 commit into
Conversation
liuxy0551
reviewed
Aug 13, 2026
Cythia828
force-pushed
the
feat/support_format
branch
4 times, most recently
from
August 20, 2026 09:32
54fffcd to
0036db5
Compare
Cythia828
force-pushed
the
feat/support_format
branch
from
August 21, 2026 03:42
0036db5 to
c8d7d63
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Feat
#226
概述
关联 #206。新增可选、可配置的 SQL 格式化能力,基于
sql-formatter。只做补全/诊断的接入方不必安装该依赖。双入口设计
monaco-sql-languagessql-formatter,仅通过setupLanguageFeatures+formatBridge协作monaco-sql-languages/formatformatSQL/formatEditorSQL等;格式化时再import('sql-formatter')package.json的exports:.·./format·./esm/*sql-formatter >= 10.7.2(optional: true)sql-formatter@10.7.2;现代浏览器可用 15+如何开启(两步,缺一不可)
工具栏或其它调用(构建期需要已安装 peer):
行为说明
format.enable默认为false)fallback(不可用或抛错)→ 原文/format却enable: true:console.error+ 抛错/format: 对已加载且开启 format 的语言做补偿注册(异步setupMode带序号,避免竞态覆盖)tabWidth: 默认4;小于 1 或非有限值回退为4;小数向下取整keybindings覆盖文档 / 演示 / Website
import '…/esm/format.entry'、共享formatFallback、工具栏调用formatEditorSQLmonaco-editor@0.54.0(tsconfig / vite 别名 + pnpm overrides),避免双份 monaco 类型冲突测试
format.test.ts:方言、fallback、加载失败、tabWidth钳制、选区切片、空操作formatBridge.test.ts:缺失入口断言、registrar ready 回调 / 立即回放迁移注意
import 'monaco-sql-languages/format',再setupLanguageFeatures(..., { format: { enable: true } })monaco-sql-languages/format引入