From 0da8e4a0739a4b1a9de56e78e2fb6a55a9f26dae Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Wed, 18 Nov 2026 22:01:26 -0800 Subject: [PATCH] =?UTF-8?q?feat(settings):=20=E5=A3=B0=E6=98=8E=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E9=93=BE=E5=88=86=E7=BB=84=E4=B8=8E=E5=8F=97=E4=BC=97?= =?UTF-8?q?=EF=BC=88toolDefinitions=201=EF=BC=89=E5=B9=B6=E8=A1=A5?= =?UTF-8?q?=E9=BD=90=E8=AE=BE=E7=BD=AE=E6=90=9C=E7=B4=A2=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/tests/repository_pins.rs | 50 +++++++++++++++++++ docs/feature-matrix.md | 9 +++- .../l10n/zh-Hans.json | 23 +++++++++ io.github.lithe-idea.java-support/plugin.json | 45 ++++++++++++++++- 4 files changed, 124 insertions(+), 3 deletions(-) diff --git a/backend/tests/repository_pins.rs b/backend/tests/repository_pins.rs index dc1fdd8..4b2f548 100644 --- a/backend/tests/repository_pins.rs +++ b/backend/tests/repository_pins.rs @@ -211,6 +211,11 @@ fn the_language_service_jdk_is_separate_from_the_project_jdk() { .iter() .find(|definition| definition["id"] == "java") .unwrap(); + assert_eq!(manifest["requires"]["toolDefinitions"], 1); + assert_eq!(text(java, "category"), "runtime"); + assert_eq!(text(java, "audience"), "user"); + assert_eq!(text(runtime, "category"), "runtime"); + assert_eq!(text(runtime, "audience"), "plugin"); // Discovery reuses full JDK installations, not editor-specific JREs. let java_discovery = java["discovery"].as_array().unwrap(); let runtime_discovery = runtime["discovery"].as_array().unwrap(); @@ -396,3 +401,48 @@ fn assert_sha256(value: &str, label: &str) { "{label} is not a lowercase SHA-256: {value}" ); } + +#[test] +fn manifest_and_zh_hans_declare_setting_regions() { + let manifest = read_json(&format!("{PLUGIN_ID}/plugin.json")); + let regions = manifest["settingRegions"] + .as_array() + .expect("settingRegions must be an array"); + let language = regions + .iter() + .find(|region| region["id"] == "language") + .expect("language settingRegion must exist"); + assert_eq!(text(&language["page"], "languageID"), "java"); + assert!( + language["keywords"] + .as_array() + .is_some_and(|items| !items.is_empty()), + "language settingRegion keywords must be non-empty" + ); + + let compiler = regions + .iter() + .find(|region| region["id"] == "compiler") + .expect("compiler settingRegion must exist"); + assert_eq!(text(&compiler["page"], "compilerID"), "java"); + assert!( + compiler["keywords"] + .as_array() + .is_some_and(|items| !items.is_empty()), + "compiler settingRegion keywords must be non-empty" + ); + + let zh = read_json(&format!("{PLUGIN_ID}/l10n/zh-Hans.json")); + for region_id in ["language", "compiler"] { + let keywords = zh["settingRegions"][region_id]["keywords"] + .as_array() + .unwrap_or_else(|| panic!("zh-Hans settingRegions.{region_id}.keywords missing")); + assert!( + !keywords.is_empty() + && keywords + .iter() + .all(|item| item.as_str().is_some_and(|s| !s.is_empty())), + "zh-Hans settingRegions.{region_id}.keywords must contain non-empty strings" + ); + } +} diff --git a/docs/feature-matrix.md b/docs/feature-matrix.md index baea152..3e15965 100644 --- a/docs/feature-matrix.md +++ b/docs/feature-matrix.md @@ -1,6 +1,13 @@ # 功能验证矩阵 -## 自动准备语言服务环境(本次改动) +## 工具链分组与设置搜索关键词(本次改动) + +| 能力 | macOS | Windows | Linux | 证据 | +| --- | --- | --- | --- | --- | +| `toolDefinitions` 升至版本 `1`:项目 `JDK`(`java`)标为 `category: "runtime"`、`audience: "user"`,服务运行环境 `JDK for JDT LS`(`jdtls-runtime`)标为 `category: "runtime"`、`audience: "plugin"`,在宿主工具链设置页归入“插件运行环境”折叠区 | implemented / verified | implemented / pending | implemented / pending | `io.github.lithe-idea.java-support/plugin.json`、`backend/tests/repository_pins.rs`(`the_language_service_jdk_is_separate_from_the_project_jdk`)、`scripts/verify-contract.py`(针对 Core `9dea6aa6eaaf830c3568b647aa7daae5018b9727`)及宿主 Viva 无头窗口渲染验证(2026-11-18 macOS arm64) | +| 声明 `settingRegions`(`language` 与 `compiler`)中英文设置搜索关键词,支持在设置侧栏检索 `jdtls`、`javac`、`字节码`、`类路径`、`Java 编译器` 等直达 Java 语言与编译器设置页 | implemented / verified | implemented / pending | implemented / pending | `io.github.lithe-idea.java-support/plugin.json`、`io.github.lithe-idea.java-support/l10n/zh-Hans.json`、`backend/tests/repository_pins.rs`(`manifest_and_zh_hans_declare_setting_regions`)、`scripts/verify-contract.py`(针对 Core `9dea6aa6eaaf830c3568b647aa7daae5018b9727`)及宿主 Viva 无头搜索定位验证(2026-11-18 macOS arm64) | + +## 自动准备语言服务环境 | 能力 | macOS | Windows | Linux | 证据 | | --- | --- | --- | --- | --- | diff --git a/io.github.lithe-idea.java-support/l10n/zh-Hans.json b/io.github.lithe-idea.java-support/l10n/zh-Hans.json index 2db7635..c0bf827 100644 --- a/io.github.lithe-idea.java-support/l10n/zh-Hans.json +++ b/io.github.lithe-idea.java-support/l10n/zh-Hans.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/Lithe-IDEA/Lithe-core-rust/main/shared/plugins/contract/v1/plugin-l10n.schema.json", "settings": { "languageServerHome": { "title": "语言服务器目录", @@ -42,5 +43,27 @@ "title": "读取项目结构", "description": "读取每个模块的源文件夹、输出文件夹、JRE 和依赖。保存时写入 Eclipse 的 .classpath 和页面列出的库配置文件;Maven、Gradle 模块只读。" } + }, + "settingRegions": { + "language": { + "keywords": [ + "语言服务器", + "堆内存", + "类路径", + "项目结构", + "模块", + "依赖", + "工程模型", + "Servlet 容器" + ] + }, + "compiler": { + "keywords": [ + "Java 编译器", + "字节码", + "编译级别", + "目标版本" + ] + } } } diff --git a/io.github.lithe-idea.java-support/plugin.json b/io.github.lithe-idea.java-support/plugin.json index db47628..6efc926 100644 --- a/io.github.lithe-idea.java-support/plugin.json +++ b/io.github.lithe-idea.java-support/plugin.json @@ -4,7 +4,7 @@ "displayName": "Java Support", "version": "4.2.0", "pluginAPIVersion": 0, - "requires": {"backend": 0, "debugAdapters": 0, "languages": 0, "languageServers": 0, "pluginFunctions": 0, "settings": 0, "projectGenerators": 0, "toolDefinitions": 0, "sourceSettings": 1, "managedRuntimes": 1}, + "requires": {"backend": 0, "debugAdapters": 0, "languages": 0, "languageServers": 0, "pluginFunctions": 0, "settings": 0, "projectGenerators": 0, "toolDefinitions": 1, "sourceSettings": 1, "managedRuntimes": 1}, "managedRuntimes": { "resolve": { "function": "java.resolveRuntimes", @@ -169,6 +169,8 @@ "icon": { "host": "plugin" }, + "category": "runtime", + "audience": "user", "executableLayouts": [ { "path": "bin/java", @@ -429,6 +431,8 @@ "icon": { "host": "plugin" }, + "category": "runtime", + "audience": "plugin", "executableLayouts": [ { "path": "bin/java", @@ -1058,5 +1062,42 @@ ] } ], - "settingActions": [{"id": "compiler", "title": "Read compiler settings", "description": "Read actual Eclipse JDT project settings. Save writes the displayed native preferences or library configuration files.", "function": "compiler.settings", "sourceEditor": {"editFunction": "compiler.prepareSettings", "languageID": "java"}, "page": {"compilerID": "java"}}, {"id": "libraries", "title": "Read project structure", "description": "Read each module's source folders, output folder, JRE and dependencies. Save writes Eclipse .classpath files and the library configuration files shown; Maven and Gradle modules are read-only.", "function": "libraries.settings", "sourceEditor": {"editFunction": "compiler.prepareSettings", "languageID": "java"}, "page": {"languageID": "java"}}] + "settingActions": [{"id": "compiler", "title": "Read compiler settings", "description": "Read actual Eclipse JDT project settings. Save writes the displayed native preferences or library configuration files.", "function": "compiler.settings", "sourceEditor": {"editFunction": "compiler.prepareSettings", "languageID": "java"}, "page": {"compilerID": "java"}}, {"id": "libraries", "title": "Read project structure", "description": "Read each module's source folders, output folder, JRE and dependencies. Save writes Eclipse .classpath files and the library configuration files shown; Maven and Gradle modules are read-only.", "function": "libraries.settings", "sourceEditor": {"editFunction": "compiler.prepareSettings", "languageID": "java"}, "page": {"languageID": "java"}}], + "settingRegions": [ + { + "id": "language", + "page": { + "languageID": "java" + }, + "keywords": [ + "JDK", + "JRE", + "JDT", + "JDT LS", + "JVM", + "heap", + "classpath", + "Eclipse", + "WTP", + "Servlet", + "Tomcat", + "Jetty", + "WEB-INF" + ] + }, + { + "id": "compiler", + "page": { + "compilerID": "java" + }, + "keywords": [ + "javac", + "bytecode", + "target", + "source level", + "JDT compiler", + "compliance" + ] + } + ] }