Repository navigation
fix(desktop): Java 文件图标缺失、调试插件声明 C 系语言后无语法高亮 - #1840
Merged
Merged
Conversation
- 插件语言没有 grammar、ID 也不是内置语言时,文件按文件名用内置语言的语法着色 (新增 Registry.SyntaxForPath,6 处调用方改用它),语言 ID 与服务器路由不变 - 恢复 IDEA 的 java.svg / java_dark.svg,*.java 显示 Java 图标
xiaoyumuxi
marked this pull request as ready for review
November 13, 2026 04:33
17 of 24 tasks
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
Viva 桌面端两处迁移回归:
.c/.h/.cpp文件整片没有语法高亮。改动 / Changes
C 语言无语法高亮
desktop/internal/editor/syntax/language.go:新增Registry.SyntaxForPath(path),按文件名给出着色用的语法。clangd声明c/h/cpp/m/...),它只负责把文件路由给插件的语言服务器和调试器;文件按文件名使用内置语言的语法着色(.c用 C、.cpp用 C++)。文档的语言 ID 仍是插件声明的clangd,clangd 与 lldb 的路由不变。ForPath的内置部分抽成bundledForName、文件名规范化抽成fileName,ForPath行为不变。ForPath+Syntax(language.ID),改为调用SyntaxForPath(documents.go、documents_tabless.go、difftab.go、plugincontent.go、problems_preview.go、source_preview.go)。语言 ID 仍取自ForPath。Java 标签页图标缺失
desktop/internal/fileicons/svg/java.svg、java_dark.svg:从旧版 macOS 客户端macos/Resources/IDEAIcons/expui/fileTypes/原样恢复(f1e8d8139^)。来源属于 NOTICE 已登记的 IntelliJ Communityexpui/fileTypes,Apache 2.0。fileicons.go:新增kindJava,*.java映射到 Java 图标,深色主题用JavaDark。icons.go:用scripts/desktop/generate-desktop-file-icons.sh重新生成,只新增 Java 两个图标,其他图标向量逐字节不变。fileicons_test.go:新增Main.java→kindJava用例,并删除 Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799 留下的旧断言{"Main.java", kindUnknown}(它记录的正是本次要修的缺失)。功能矩阵
project-file-type-icons:能力、验证、备注补上*.java。plugin-editor-grammars:补上无 grammar 插件语言回落到内置语法的验证与备注,证据加上language.go。不在本 PR 范围内 / Out of scope
clangd。宿主修复后高亮已恢复,是否拆成c/cpp/objective-c由插件维护者决定,本 PR 不改插件。objective-c本来就没有 grammar,.m文件仍无高亮,与本回归无关。类型专属:fix
复现与根因
main.c:实际整片无高亮,期望显示 C 关键字、字符串、数字颜色。Main.java:实际标签页和项目树显示未知文件图标,期望显示 Java 图标。SetPluginLanguages把 ID 不在内置表里、又没有 grammar 的插件语言注册成 Scope 为空的语言。插件语言在ForPath中优先匹配,Syntax(clangd)返回 nil,于是 C 系文件全部丢失内置语法。java.svg,fileKind也没有java分支。检查项
desktop/internal/workbench/documents_test.go的TestOpenFileOfGrammarlessPluginLanguageKeepsBundledColors,修复前输出main.c shows no C keyword colors: [{0 }];另有desktop/internal/editor/syntax/language_test.go的TestPluginLanguageWithoutGrammarKeepsBundledColors和fileicons_test.go的Main.java用例ForPath+Syntax的 6 处调用全部改用SyntaxForPath;runs.go的Syntax("")不按路径取语法,未改.agents/notes/implemented/bug-fix/记录:规则写在SyntaxForPath注释里,并由两个回归测试守住范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json:project-file-type-icons、plugin-editor-grammars,验证状态保持pending./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和verify-platform-feature-matrix-change.sh origin/preview HEAD.artifacts/下生成的矩阵视图统一日志系统 / Structured logging
N/A:没有新增或改动生命周期、终态、降级或失败路径。
界面文案 / i18n
N/A:没有新增用户可见文案;已运行
verify-app-language-localization.mjs与generate-i18n.mjs --check,均通过。逻辑归属 / Logic placement
internal/editor/syntax,两端同一份代码性能与内存 / Performance and memory
N/A:语法查找只在打开文件时多做一次文件名匹配,没有新增后台任务、缓存或主线程 I/O。
设置 / Settings
N/A:没有改设置。
插件契约 / Plugin contract
N/A:没有改契约、能力版本或宿主方法。
发行包与资源 / Bundle and resources
scripts/desktop/verify/verify-runtime-bundle-immutability.sh无用代码与重构 / Dead code and refactoring
ForPath+Syntax拼接已删除验证 / Verification
scripts/desktop/desktop-go.sh test ./internal/fileicons/ ./internal/editor/... ./internal/workbench/scripts/desktop/desktop-go.sh vet ./internal/workbench/ ./internal/editor/syntax/documents.go)运行main.c shows no C keyword colors,修复后通过LITHE_ICON_PYTHON=python3.11 zsh scripts/desktop/generate-desktop-file-icons.shnode scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --checkscripts/platform-feature-matrix/verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/preview HEADzsh scripts/desktop/verify/verify-runtime-bundle-immutability.sh.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/preview未能执行的检查和原因: Windows 实机未运行;Windows 与 macOS 共用同一份 Viva 代码,组件测试已覆盖。整机上装 lldb-debug 插件后打开
main.c与Main.java的人工验收待做。提交前确认 / Final checks
preview创建;目标分支:preview