Repository navigation
feat: language configuration for all 12 dialects (comment toggle, bracket matching, auto-closing) - #19
Merged
Conversation
…cket matching, auto-closing) Problem: contributes.languages registered 12 language IDs but none carried a language configuration — Cmd+/ did nothing on .hql/.mysql/.sparksql files, and bracket matching / quote auto-closing were missing (.sql only worked because VSCode's built-in SQL extension ships its own config). Generated pipeline (same architecture as the v2.35.0 TextMate grammar work): - src/grammar/languageConfigBuilder.ts derives comments / brackets / autoClosingPairs / surroundingPairs directly from each dialect's tokenizerOptions (lineCommentTypes, extraParens, identTypes, stringTypes) — single data source, zero manual lists, zero drift from the formatter. - scripts/generate-language-configs.ts writes 12 language-configurations/<langId>.language-configuration.json files, committed to git; script wired into vscode:prepublish / esbuild chains. - package.json: contributes.languages[].configuration wired for all 12. Dialect-aware derivation: - [] brackets where extraParens or identTypes use them (hive, spark, postgresql, bigquery, sqlite, sqlserver); backtick auto-close for the mysql-family; quote chars collected from actual stringTypes/identTypes. - MySQL/BigQuery/StarRocks # comments stay syntax-highlighted only (VSCode supports a single lineComment, standard -- wins Cmd+/ toggling). - Deliberately NOT generated: onEnterRules / indentationRules / wordPattern — no data source for them; wrong indentation is worse than none. Verification: tsc --noEmit, oxlint, oxfmt --check, vscode:prepublish chain, 24/24 tests (5 new languageConfig golden/consistency/derivation tests + 19 grammar tests re-run clean). Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
问题
contributes.languages注册了 12 个语言 ID 但均无语言配置 ——.hql/.mysql/.sparksql等文件上Cmd+/无反应,括号匹配与引号自动闭合缺失(.sql可用仅因 VSCode 内置 SQL 扩展自带配置)。方案
与 v2.35.0 语法高亮同构的生成管线(单一数据源,零手工清单,零漂移):
src/grammar/languageConfigBuilder.ts:从lineCommentTypes派生注释符(--//* */)、extraParens∪identTypes派生方括号、stringTypes∪identTypes派生引号自动闭合(含notIn: ["string", "comment"])scripts/generate-language-configs.ts:构建脚本,接入vscode:prepublish/esbuild链language-configurations/× 12:生成物入库(构建环境可能没有完整工具链),golden 测试防漂移src/test/languageConfig.test.ts:5 个新测试(结构 / golden / package.json 一致性 / 全方言断言 / 方言差异快照)docs/prd/025-语言配置.md:PRD 文档(仓库惯例)方言差异(自动派生)
[]:Hive / Spark / PostgreSQL / BigQuery / SQLite(经extraParens)、SQL Server(经identTypes)#注释保持语法着色但不参与Cmd+/(VSCode 仅支持单一行注释符,取 SQL 标准--)onEnterRules/indentationRules/wordPattern:无数据来源,错误的缩进规则比缺失更糟验证
tsc --noEmit/oxlint/oxfmt --check/vscode:prepublish完整打包链vscode-test全量运行受沙箱限制(Electron 启动被 SIGKILL),目标测试套件经 mocha TDD 直跑验证;CI 将做全量验证🤖 Generated with Claude Code