From 714b41f1623f09f13f476c5493fbc3876a13e2a3 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Wed, 18 Nov 2026 22:01:37 -0800 Subject: [PATCH] =?UTF-8?q?feat(settings):=20=E5=A3=B0=E6=98=8E=20Tomcat?= =?UTF-8?q?=20=E8=AE=BE=E7=BD=AE=E9=A1=B5=E6=90=9C=E7=B4=A2=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E8=AF=8D=E4=B8=8E=E5=88=86=E7=BB=84=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/feature-matrix.md | 4 ++-- io.github.lithe-idea.tomcat/l10n/zh-Hans.json | 15 ++++++++++++++ io.github.lithe-idea.tomcat/plugin.json | 20 +++++++++++++++++++ scripts/test.mjs | 10 ++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/docs/feature-matrix.md b/docs/feature-matrix.md index 570cbc8..b5c15d5 100644 --- a/docs/feature-matrix.md +++ b/docs/feature-matrix.md @@ -19,7 +19,7 @@ | `tomcat-run` | 构建模块并在私有 CATALINA_BASE 中运行,HTTP 可访问 | implemented / pending | implemented / pending | implemented / pending | 同上;2026-11-18 宿主端到端测试 `TestTomcatPluginRunsAWebModule` 通过(macOS arm64,宿主 1lck/Lithe-IDEA c47ae049,含 #2145,Tomcat 9.0.124 与 10.1.62):运行配置启动、页面可访问、运行窗口有 Tomcat 日志、Stop 释放端口 | | `tomcat-in-place` | Eclipse 项目和普通 Web 目录原地运行,挂载编译输出,JSP 修改无需重新部署 | implemented / pending | implemented / pending | implemented / pending | 同上 | | `tomcat-debug` | 按 `java` 调试类型连接调试,Tomcat 以 `suspend=y` 等待 | implemented / pending | implemented / pending | implemented / pending | `scripts/test.mjs` 验证到 JDWP 握手;2026-11-18 宿主端到端测试 `TestTomcatPluginDebugsAWebModule` 通过(同上,Java Support 4.0.1,JDK 21):Java 调试器连接,请求停在项目源码断点,Continue 后完成 | -| `tomcat-settings` | Tomcat 安装目录与 HTTP 端口设置,中英文 | implemented / pending | implemented / pending | implemented / pending | 2026-11-18 清单与翻译通过 Core 校验;宿主端到端测试在读取模型后保存设置再运行,新值生效(需要 1lck/Lithe-IDEA#2142 的修复);宿主界面未验收。提供者错误提示暂时只有英文(1lck/Lithe-IDEA#2144) | +| `tomcat-settings` | Tomcat 安装目录与 HTTP 端口设置(中英文)及 `settingRegions.build` 设置搜索关键词与分组翻译 | implemented / pending | implemented / pending | implemented / pending | 2026-11-18 清单与翻译(含 `settingRegions.build` 与 `sections.Tomcat`)通过 Core `9dea6aa6eaaf830c3568b647aa7daae5018b9727` 契约校验,`scripts/test.mjs`(Tomcat 9.0.124 与 10.1.62)全部通过,并经宿主 Viva 设置搜索无头预览验证;宿主端到端测试曾于 2026-11-18 在读取模型后保存设置再运行并验证新值生效(需要 1lck/Lithe-IDEA#2142 的修复);提供者错误提示暂时只有英文(1lck/Lithe-IDEA#2144) | ## 证据与验证方法 @@ -29,7 +29,7 @@ | `tomcat-run` | `Preparation.java`、`CatalinaBase.java` | “the Maven module builds…”、“the Gradle war module…” | 从运行配置运行,运行窗口显示构建输出和 Tomcat 启动日志,浏览器打开 `http://localhost:<端口><上下文>/` | | `tomcat-in-place` | `WebModules.java`(WTP、普通目录)、`CatalinaBase.contextXml` | “the Eclipse project is served in place…”、“a plain Web folder…” | 运行 Eclipse 项目,修改 JSP 后刷新页面看到新内容 | | `tomcat-debug` | `Preparation.launch`、`plugin.json` 的 `debug.configurationType` | “a debug run suspends Tomcat…” | 装好 Java 插件后调试运行,在 Servlet 或 JSP 编译出的类上设断点并命中 | -| `tomcat-settings` | `plugin.json` 的 `settings`、`l10n/zh-Hans.json` | `scripts/test.mjs`:缺少 Tomcat 时的中文提示 | 中英文界面下打开设置页,修改安装目录和端口后运行使用新值 | +| `tomcat-settings` | `plugin.json` 的 `settings` 与 `settingRegions.build`(`CATALINA_HOME`、`Servlet`、`JSP`、`WAR`、`HTTP port` 等)、`l10n/zh-Hans.json` 的 `settings`、`sections.Tomcat` 与 `settingRegions.build.keywords`(`Tomcat 安装目录`、`HTTP 端口`、`Web 模块`、`应用服务器`、`容器`) | `scripts/test.mjs`:缺少 Tomcat 时的中文提示、`settingRegions` 关键词与中文翻译断言 | 中英文界面下打开设置页并搜索中英文关键词定位“Tomcat”区域,修改安装目录和端口后运行使用新值 | CI(`.github/workflows/ci.yml`)在 Linux 上用 JDK 17 和 JDK 8 运行同一套测试,ready 状态的 PR 还会在 Windows 上用 `mvn.cmd` 和 `gradle.bat` 运行,并在 Linux 上对固定的宿主运行宿主端到端测试(`host` 任务)。 diff --git a/io.github.lithe-idea.tomcat/l10n/zh-Hans.json b/io.github.lithe-idea.tomcat/l10n/zh-Hans.json index ffa45e5..53511a4 100644 --- a/io.github.lithe-idea.tomcat/l10n/zh-Hans.json +++ b/io.github.lithe-idea.tomcat/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": { "tomcatHome": { "title": "Tomcat 安装目录", @@ -9,5 +10,19 @@ "title": "HTTP 端口", "description": "Tomcat 在 127.0.0.1 上提供该模块的端口。" } + }, + "sections": { + "Tomcat": "Tomcat" + }, + "settingRegions": { + "build": { + "keywords": [ + "Tomcat 安装目录", + "HTTP 端口", + "Web 模块", + "应用服务器", + "容器" + ] + } } } diff --git a/io.github.lithe-idea.tomcat/plugin.json b/io.github.lithe-idea.tomcat/plugin.json index 03df90b..7592512 100644 --- a/io.github.lithe-idea.tomcat/plugin.json +++ b/io.github.lithe-idea.tomcat/plugin.json @@ -53,6 +53,26 @@ "section": "Tomcat" } ], + "settingRegions": [ + { + "id": "build", + "page": { + "buildSystemID": "tomcat" + }, + "keywords": [ + "CATALINA_HOME", + "CATALINA_BASE", + "Servlet", + "JSP", + "WAR", + "exploded", + "web.xml", + "HTTP port", + "8080", + "127.0.0.1" + ] + } + ], "buildSystems": [ { "id": "tomcat", diff --git a/scripts/test.mjs b/scripts/test.mjs index 8c7043b..b5133d6 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -391,6 +391,16 @@ await withInterrupts(async (signal) => { await suite(home, signal); } await check("without a Tomcat home the run fails with the localized setup message", missingHome); + await check("the manifest declares settingRegions search keywords and Chinese translations", () => { + const manifest = JSON.parse(readFileSync(join(pluginDir, "plugin.json"), "utf8")); + const buildRegion = (manifest.settingRegions ?? []).find((region) => region.id === "build"); + assert.equal(buildRegion?.page?.buildSystemID, "tomcat"); + assert.ok(Array.isArray(buildRegion?.keywords) && buildRegion.keywords.length > 0); + + const zh = JSON.parse(readFileSync(join(pluginDir, "l10n", "zh-Hans.json"), "utf8")); + assert.ok(zh.sections?.Tomcat, "zh-Hans sections.Tomcat"); + assert.ok(Array.isArray(zh.settingRegions?.build?.keywords) && zh.settingRegions.build.keywords.length > 0); + }); await check("the plugin package is unchanged", () => assert.equal(treeHash(pluginDir), packageBefore)); } catch (error) { failed = true;