diff --git a/README.md b/README.md index 331ec9f..0716851 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ > 在内存中补全类路径并自动找到 Tomcat 等 Servlet 容器,不修改项目文件,详见 [docs/project-models.md](docs/project-models.md)。 > > **3.0.0 起使用你自己的 JDT LS**:插件包不再附带 Eclipse JDT Language Server 和运行它的 JDK(包从约 250 MB 降到约 11 MB), -> 做法和 Go 插件使用你自己的 `gopls` 一样。需要先安装 JDT LS(例如 `brew install jdtls`)和 JDK 21 或更新版本, +> 做法和 Go 插件使用你自己的 `gopls` 一样。需要先安装 JDT LS 和满足其要求的运行 JDK(至少 21,JDT LS 1.63+ 需要 25), > 详见下文[语言服务器与 JDK](#语言服务器与-jdk)。 > **Viva 预览版 Java 支持(1.2.0)**:清单已迁到当前契约 0,后端使用 Core @@ -204,16 +204,28 @@ Spring/MyBatis 等既有能力不属于本轮 Maven 验收范围。 5. VS Code 及其衍生编辑器里 Java 扩展(`redhat.java`)自带的 `server/`,取最新版本。 目录(或其中的 `libexec/`)里要有唯一一个 `plugins/org.eclipse.equinox.launcher_*.jar` 和当前平台的 - `config_<平台>/config.ini`。安装方式举例:macOS / Linux 用 `brew install jdtls`;也可以从 - [download.eclipse.org/jdtls](https://download.eclipse.org/jdtls/milestones/) 下载解压,再在设置里选目录。 + `config_<平台>/config.ini`。从 [Eclipse 官方下载目录](https://download.eclipse.org/jdtls/milestones/) 选择版本, + 下载归档并核对该版本发布的校验值,解压到自己的可写目录,再在设置里选择解压后的根目录(不是压缩包或 `bin`)。 + macOS 已安装 Homebrew 时也可用 `brew install jdtls`;Windows 和 Linux 不再收到这条 macOS 指引。 + + | 系统 / 架构 | 必须存在的配置文件 | + | --- | --- | + | Windows x64 / ARM64 | `config_win/config.ini` | + | macOS x64 / ARM64 | `config_mac/config.ini` / `config_mac_arm/config.ini` | + | Linux x64 / ARM64 | `config_linux/config.ini` / `config_linux_arm/config.ini` | + 已测试 JDT LS 1.61.0(CI 固定,见 `third_party/jdtls/manifest.json`)和 Homebrew 1.60.0。 2. **满足目标 JDT LS 要求的 JDK(至少 JDK 21;JDT LS 1.63+ 要求 JDK 25)**,用来运行 JDT LS。它是插件新增的「JDK for JDT LS」工具(`jdtls-runtime`), 在设置 → 构建、执行、部署 → 工具链里显示和选择;没选时依次用登录 shell 的 `java`(仅匹配 21 及更新版本,跳过 `PATH` 上的 Java 8/11/17)和找到的最高版本 JDK(含系统 JDK 目录与 VS Code / Cursor `redhat.java` 扩展自带的 `jre/`)。 后端会从目标 JDT LS 核心 bundle 的 `MANIFEST.MF`(`Bundle-RequiredExecutionEnvironment`)读取实际最低 Java 版本,低于该版本时启动直接报错并提示去工具链里选择。项目自己的 JDK 是原来的「JDK」工具(`java`),两者互不影响。 JDT 只能为它支持的 Java 版本编译:没有为项目选 JDK 时,JDT 用运行它的 JDK 编译,这个 JDK 比 JDT LS 支持的最新 Java 还新时编译会报错。 -找不到 JDT LS 时,语言服务启动失败(`launch.server_missing`),错误信息说明如何安装或去哪里设置。 -宿主当前的 `commandInstallers` 只能安装 `systemCommand` 启动的命令,JDT LS 由插件后端启动,所以还不能像 Go 插件那样在插件详情里一键安装。 +找不到 JDT LS 时返回 `launch.server_missing`,显式目录无效时返回 `launch.server_invalid`;两种错误均提供对应系统的目录结构、官方下载地址和本地选择入口。显式目录无效时不会静默改用其他安装,也不会清空配置。运行 JDK 过旧时返回 `launch.runtime_too_old`,按所选 JDT LS 的实际 bundle 要求提示版本,而不是先固定报 Java 21。 + +未安装运行 JDK 时,从 [Eclipse Temurin 官方页面](https://adoptium.net/temurin/releases/) 选择满足要求、匹配系统和 CPU 架构的 **JDK** 归档,核对发布的校验值后解压。在「JDK for JDT LS」工具链中选择其根目录(含 `bin/java.exe` 或 `bin/java`;macOS `.jdk` 内为 `Contents/Home`)。保留项目「JDK」选择和全局 PATH,配置后重启 Java 语言服务器。下载或校验失败时不要选择或执行该归档中的程序;重新从官方来源获取。 + +这是**下载与本地配置引导,不是自动安装器**:现有目录选择器负责用户确认,错误中的 URL 是文本地址,不保证宿主渲染为可点击链接。清单设置说明同步提供中英文引导;后端错误文案仍受 API-37 本地化接口缺口限制,以英文返回。没有运行版本事实时继续交由宿主工具链解析处理,不把“未知”误报为“已兼容”。 +宿主已有插件状态目录,但 API-38 托管网络/下载尚未实现;当前 `commandInstallers` 只能安装 `systemCommand` 启动的命令,JDT LS 使用后端启动。本次不增加未校验下载、静默安装、全局 PATH 修改、项目 JDK 修改或宿主 Java 特判。 ## 工作方式 diff --git a/backend/src/jdtls.rs b/backend/src/jdtls.rs index e39c9d2..f2aa3ce 100644 --- a/backend/src/jdtls.rs +++ b/backend/src/jdtls.rs @@ -88,16 +88,46 @@ const EDITOR_EXTENSION_ENTRY_BUDGET: usize = 4096; /// TODO(host-api: API-37 i18n): user-facing text must go through the host's /// i18n table. pub const SERVER_MISSING_MESSAGE: &str = "Java Support needs the Eclipse JDT Language Server, \ -which was not found on this computer. Install it (for example with `brew install jdtls`), \ -or choose its folder in Settings > Languages & Frameworks > Java > Language server folder."; +which was not found on this computer."; /// Message of [`LAUNCH_SERVER_INVALID`]. /// /// TODO(host-api: API-37 i18n): user-facing text must go through the host's /// i18n table. pub const SERVER_INVALID_MESSAGE: &str = "The language server folder chosen in the Java \ -settings does not contain the Eclipse JDT Language Server for this platform. Choose the \ -folder that contains plugins and the config folders, or clear the setting to find JDT LS \ -automatically."; +settings does not contain a usable Eclipse JDT Language Server for this platform. \ +Your explicit choice has been kept; no other installation was selected. \ +Choose a valid folder, or clear the setting to enable automatic discovery."; + +/// Official distribution pages. These are guidance only: launch never downloads +/// or executes an installer, changes PATH, or changes either toolchain selection. +pub const SERVER_DOWNLOAD_URL: &str = "https://download.eclipse.org/jdtls/milestones/"; +pub const JDK_DOWNLOAD_URL: &str = "https://adoptium.net/temurin/releases/"; + +/// Recovery instructions use the requested platform, not the backend build host, +/// so Windows never receives a Homebrew command or a macOS configuration folder. +/// TODO(host-api: API-37 i18n): localize backend messages when the host supports it. +pub fn server_setup_message(reason: &str, os: &str, arch: &str) -> String { + let Some(configuration) = configuration_name(os, arch) else { + return format!( + "{reason} This operating system or architecture is not supported by Java Support." + ); + }; + let package_manager = if os == "macos" { + " On macOS with Homebrew installed, you can also use `brew install jdtls`." + } else { + "" + }; + format!( + "{reason} Download JDT LS from {SERVER_DOWNLOAD_URL}, verify the published checksum, \ +then extract the archive into a user-owned folder.{package_manager} In Settings > Languages & \ +Frameworks > Java > Language server folder, select the extracted folder containing exactly one \ +plugins/org.eclipse.equinox.launcher_*.jar and {configuration}/config.ini (not the archive or bin folder). \ +JDT LS also needs a separate runtime JDK: at least Java 21, or Java 25 for JDT LS 1.63+. \ +Download a JDK for your operating system and architecture from {JDK_DOWNLOAD_URL} and select it \ +as \"JDK for JDT LS\" in Settings > Build, Execution, Deployment > Toolchains. \ +Keep the project's \"JDK\" selection and global PATH unchanged. Restart the Java language server after configuring." + ) +} /// The JDT LS files a launch uses, absolute. #[derive(Debug, Clone, PartialEq, Eq)] @@ -302,11 +332,19 @@ pub fn locate_for_runtime( arch: &str, runtime_java_version: Option, ) -> Result { - let configuration = configuration_name(os, arch) - .ok_or_else(|| PluginError::new(LAUNCH_SERVER_MISSING, SERVER_MISSING_MESSAGE))?; + let configuration = configuration_name(os, arch).ok_or_else(|| { + PluginError::new( + LAUNCH_SERVER_MISSING, + server_setup_message(SERVER_MISSING_MESSAGE, os, arch), + ) + })?; if let Some(folder) = configured { - return inspect(folder, configuration) - .ok_or_else(|| PluginError::new(LAUNCH_SERVER_INVALID, SERVER_INVALID_MESSAGE)); + return inspect(folder, configuration).ok_or_else(|| { + PluginError::new( + LAUNCH_SERVER_INVALID, + server_setup_message(SERVER_INVALID_MESSAGE, os, arch), + ) + }); } let mut first = None; for folder in candidates(environment, os) { @@ -320,7 +358,12 @@ pub fn locate_for_runtime( first = Some(installation); } } - first.ok_or_else(|| PluginError::new(LAUNCH_SERVER_MISSING, SERVER_MISSING_MESSAGE)) + first.ok_or_else(|| { + PluginError::new( + LAUNCH_SERVER_MISSING, + server_setup_message(SERVER_MISSING_MESSAGE, os, arch), + ) + }) } /// The folders [`locate`] tries without a configured one, in order. A folder @@ -529,7 +572,10 @@ mod tests { // An unusable choice fails instead of falling back to another installation. let error = locate(Some(&temp.0.join("empty")), &search, "linux", "x86_64").unwrap_err(); assert_eq!(error.code(), LAUNCH_SERVER_INVALID); - assert_eq!(error.message(), SERVER_INVALID_MESSAGE); + assert_eq!( + error.message(), + server_setup_message(SERVER_INVALID_MESSAGE, "linux", "x86_64") + ); // Without a choice the discovered installation is used. assert_eq!( locate(None, &search, "linux", "x86_64").unwrap().home, @@ -537,12 +583,60 @@ mod tests { ); } + #[test] + fn setup_guidance_matches_each_supported_platform() { + for (os, arch, config) in [ + ("windows", "x86_64", "config_win"), + ("windows", "arm64", "config_win"), + ("macos", "x86_64", "config_mac"), + ("macos", "arm64", "config_mac_arm"), + ("linux", "x86_64", "config_linux"), + ("linux", "arm64", "config_linux_arm"), + ] { + for reason in [SERVER_MISSING_MESSAGE, SERVER_INVALID_MESSAGE] { + let message = server_setup_message(reason, os, arch); + assert!( + message.contains(&format!("{config}/config.ini")), + "{os}/{arch}" + ); + assert_eq!(message.contains("brew install"), os == "macos"); + assert!(message.contains(SERVER_DOWNLOAD_URL)); + assert!(message.contains(JDK_DOWNLOAD_URL)); + assert!(message.contains("checksum")); + assert!(message.contains("global PATH unchanged")); + } + } + let unsupported = server_setup_message(SERVER_MISSING_MESSAGE, "plan9", "x86_64"); + assert!(unsupported.contains("not supported")); + assert!(!unsupported.contains("Download")); + } + + #[test] + fn missing_windows_server_has_official_download_and_local_selection_guidance() { + let temp = TempDir::new(); + let error = locate(None, &environment(&temp.0), "windows", "x86_64").unwrap_err(); + assert_eq!(error.code(), LAUNCH_SERVER_MISSING); + assert!(!error.message().contains("brew")); + assert!(error + .message() + .contains("https://download.eclipse.org/jdtls/milestones/")); + assert!(error + .message() + .contains("plugins/org.eclipse.equinox.launcher_*.jar")); + assert!(error.message().contains("config_win/config.ini")); + assert!(error.message().contains("Language server folder")); + assert!(error.message().contains("JDK for JDT LS")); + } + #[test] fn nothing_found_is_one_error_that_names_no_path() { let temp = TempDir::new(); let error = locate(None, &environment(&temp.0), "windows", "x86_64").unwrap_err(); assert_eq!(error.code(), LAUNCH_SERVER_MISSING); - assert_eq!(error.message(), SERVER_MISSING_MESSAGE); + assert_eq!( + error.message(), + server_setup_message(SERVER_MISSING_MESSAGE, "windows", "x86_64") + ); assert!(!error.message().contains(temp.0.to_string_lossy().as_ref())); let error = locate(None, &environment(&temp.0), "plan9", "x86_64").unwrap_err(); assert_eq!(error.code(), LAUNCH_SERVER_MISSING); diff --git a/backend/src/launch.rs b/backend/src/launch.rs index 7048842..4df1355 100644 --- a/backend/src/launch.rs +++ b/backend/src/launch.rs @@ -105,22 +105,19 @@ pub const LAUNCH_ERROR_CODES: &[&str] = &[ pub const SERVER_RUNTIME_TOOL: &str = "jdtls-runtime"; /// Oldest Java feature release JDT LS runs on. pub const MINIMUM_SERVER_JAVA_VERSION: u64 = 21; -/// Message of [`LAUNCH_RUNTIME_TOO_OLD`] for [`MINIMUM_SERVER_JAVA_VERSION`]. -/// -/// TODO(host-api: API-37 i18n): user-facing text must go through the host's -/// i18n table. -pub const RUNTIME_TOO_OLD_MESSAGE: &str = "The Eclipse JDT Language Server needs Java 21 or \ -later, but the JDK chosen for it is older. Choose a JDK 21 or later for \"JDK for JDT LS\" in \ -Settings > Build, Execution, Deployment > Toolchains."; - /// Message of [`LAUNCH_RUNTIME_TOO_OLD`] for the Java feature release /// `minimum_java_version` the selected JDT LS installation requires. +/// TODO(host-api: API-37 i18n): localize backend messages when the host supports it. pub fn runtime_too_old_message(minimum_java_version: u64) -> String { let minimum = minimum_java_version.max(MINIMUM_SERVER_JAVA_VERSION); + let download = jdtls::JDK_DOWNLOAD_URL; format!( "The Eclipse JDT Language Server needs Java {minimum} or later, but the JDK chosen for \ it is older. Choose a JDK {minimum} or later for \"JDK for JDT LS\" in Settings > Build, \ -Execution, Deployment > Toolchains." +Execution, Deployment > Toolchains. If none is installed, download a JDK for your operating \ +system and architecture from {download}, verify its published checksum, and extract it into \ +a user-owned folder. Select that JDK for JDT LS only; keep the project's \"JDK\" selection \ +and global PATH unchanged. Restart the Java language server after configuring." ) } @@ -725,7 +722,6 @@ pub fn resolve_launch_function( ) -> Result { context.check_cancelled()?; let request = parse_launch_params(¶ms)?; - check_server_runtime(&request)?; let server = jdtls::locate_for_runtime( request.server_home.as_deref(), &SearchEnvironment::current(), @@ -733,6 +729,9 @@ pub fn resolve_launch_function( &request.architecture, server_runtime_feature(&request), )?; + // Check the selected server's actual requirement before touching package + // resources or collecting project settings (e.g. report 25, not the floor 21). + check_server_runtime_for(&request, server.minimum_java_version)?; let package_root = package_root()?; let diagnostics = context.diagnostics(); let operation = context.function_id().to_owned(); @@ -1227,7 +1226,7 @@ mod tests { ) .unwrap_err(); assert_eq!(error.code(), LAUNCH_RUNTIME_TOO_OLD); - assert_eq!(error.message(), RUNTIME_TOO_OLD_MESSAGE); + assert_eq!(error.message(), runtime_too_old_message(21)); } } assert!(fs::read_dir(fixture.root.join("state")) diff --git a/backend/tests/repository_pins.rs b/backend/tests/repository_pins.rs index cf2aa6e..0e00cf7 100644 --- a/backend/tests/repository_pins.rs +++ b/backend/tests/repository_pins.rs @@ -288,6 +288,131 @@ fn the_users_jdt_ls_runs_on_the_declared_runtime_tool() { ); } +#[test] +fn settings_and_localizations_fit_within_core_text_limits() { + // Core's `plugin-model` rejects settings or l10n descriptions longer than + // `MAX_SETTING_TEXT * 4` (480 Unicode scalar values) and labels longer than + // `MAX_SETTING_TEXT` (120). Catching this offline prevents shipping a + // manifest the host cannot admit. + const MAX_SETTING_TEXT: usize = 120; + const MAX_DESCRIPTION_TEXT: usize = MAX_SETTING_TEXT * 4; + + let check_text = |value: &str, max: usize, field: &str| { + let count = value.chars().count(); + assert!( + !value.trim().is_empty() && count <= max, + "{field} must be non-empty and at most {max} characters, got {count}" + ); + }; + + let manifest = read_json(&format!("{PLUGIN_ID}/plugin.json")); + for setting in manifest["settings"].as_array().unwrap() { + let id = text(setting, "id"); + check_text( + text(setting, "title"), + MAX_SETTING_TEXT, + &format!("{id}.title"), + ); + if let Some(description) = setting.get("description").and_then(Value::as_str) { + check_text( + description, + MAX_DESCRIPTION_TEXT, + &format!("{id}.description"), + ); + } + for key in ["placeholder", "unit", "section"] { + if let Some(value) = setting.get(key).and_then(Value::as_str) { + check_text(value, MAX_SETTING_TEXT, &format!("{id}.{key}")); + } + } + if let Some(options) = setting.get("options").and_then(Value::as_array) { + for option in options { + let option_value = text(option, "value"); + check_text( + text(option, "title"), + MAX_SETTING_TEXT, + &format!("{id}.options.{option_value}"), + ); + } + } + } + for action in manifest["settingActions"].as_array().unwrap() { + let id = text(action, "id"); + check_text( + text(action, "title"), + MAX_SETTING_TEXT, + &format!("settingActions.{id}.title"), + ); + if let Some(description) = action.get("description").and_then(Value::as_str) { + check_text( + description, + MAX_DESCRIPTION_TEXT, + &format!("settingActions.{id}.description"), + ); + } + } + + let l10n_dir = repository_root().join(PLUGIN_ID).join("l10n"); + for entry in fs::read_dir(&l10n_dir).unwrap() { + let path = entry.unwrap().path(); + if path.extension().and_then(|ext| ext.to_str()) != Some("json") { + continue; + } + let name = path.file_name().unwrap().to_string_lossy().into_owned(); + let file = read_json(&format!("{PLUGIN_ID}/l10n/{name}")); + if let Some(settings) = file.get("settings").and_then(Value::as_object) { + for (id, item) in settings { + if let Some(description) = item.get("description").and_then(Value::as_str) { + check_text( + description, + MAX_DESCRIPTION_TEXT, + &format!("{name}: settings.{id}.description"), + ); + } + for key in ["title", "placeholder", "unit"] { + if let Some(value) = item.get(key).and_then(Value::as_str) { + check_text( + value, + MAX_SETTING_TEXT, + &format!("{name}: settings.{id}.{key}"), + ); + } + } + if let Some(options) = item.get("options").and_then(Value::as_object) { + for (option_value, option_title) in options { + let option_title = option_title.as_str().unwrap_or_else(|| { + panic!("{name}: settings.{id}.options.{option_value} must be string") + }); + check_text( + option_title, + MAX_SETTING_TEXT, + &format!("{name}: settings.{id}.options.{option_value}"), + ); + } + } + } + } + if let Some(actions) = file.get("settingActions").and_then(Value::as_object) { + for (id, item) in actions { + if let Some(title) = item.get("title").and_then(Value::as_str) { + check_text( + title, + MAX_SETTING_TEXT, + &format!("{name}: settingActions.{id}.title"), + ); + } + if let Some(description) = item.get("description").and_then(Value::as_str) { + check_text( + description, + MAX_DESCRIPTION_TEXT, + &format!("{name}: settingActions.{id}.description"), + ); + } + } + } + } +} + #[test] fn third_party_inputs_are_pinned_by_https_url_and_sha256() { let relative = "third_party/jdtls/manifest.json"; diff --git a/backend/tests/session.rs b/backend/tests/session.rs index 705807c..d3c0368 100644 --- a/backend/tests/session.rs +++ b/backend/tests/session.rs @@ -182,6 +182,81 @@ fn only_fact<'a>(logs: &'a [Value], kind: &str) -> &'a Value { facts[0] } +#[test] +fn launch_reports_the_selected_servers_java_requirement_before_package_checks() { + use std::fs; + use std::path::PathBuf; + + struct Fixture(PathBuf); + impl Drop for Fixture { + fn drop(&mut self) { + let _ = fs::remove_dir_all(&self.0); + } + } + let fixture = Fixture( + std::env::temp_dir().join(format!("lithe-java-setup-session-{}", std::process::id())), + ); + fs::create_dir_all(fixture.0.join("plugins")).unwrap(); + fs::create_dir_all(fixture.0.join("config_win")).unwrap(); + fs::write( + fixture.0.join("plugins/org.eclipse.equinox.launcher_1.jar"), + b"", + ) + .unwrap(); + fs::write( + fixture.0.join("config_win/config.ini"), + b"osgi.bundles=example\n", + ) + .unwrap(); + let file = fs::File::create(fixture.0.join("plugins/org.eclipse.jdt.ls.core_1.jar")).unwrap(); + let mut zip = zip::ZipWriter::new(file); + zip.start_file( + "META-INF/MANIFEST.MF", + zip::write::SimpleFileOptions::default(), + ) + .unwrap(); + zip.write_all(b"Bundle-RequiredExecutionEnvironment: JavaSE-25\n") + .unwrap(); + zip.finish().unwrap(); + + let mut host = Host::start(); + assert!(host.initialize().get("error").is_none()); + let mut params = json!({ + "serverID": "java", "platform": {"os": "windows", "arch": "x86_64"}, + "stateDirectory": fixture.0.join("state"), + "workspaceStateDirectory": fixture.0.join("workspace-state"), + "logDirectory": fixture.0.join("log"), "temporaryDirectory": fixture.0.join("tmp"), + "settings": {"languageServerHome": fixture.0}, + "tools": { + "jdtls-runtime": {"version": "17.0.19"}, + "java": {"version": "8.0.392", "home": fixture.0.join("project-jdk")} + } + }); + let (reply, logs) = host.invoke_with_logs(1, "java.resolveLaunch", params.clone()); + assert_eq!(reply["error"]["data"]["code"], "launch.runtime_too_old"); + let message = reply["error"]["message"].as_str().unwrap(); + assert!(message.contains("Java 25 or later"), "{message}"); + assert!(message.contains("https://adoptium.net/temurin/releases/")); + assert_eq!( + only_fact(&logs, "operationFailed")["code"], + "launch.runtime_too_old" + ); + assert!(!fixture.0.join("state").exists()); + + params["settings"]["languageServerHome"] = json!(fixture.0.join("missing")); + let (reply, logs) = host.invoke_with_logs(2, "java.resolveLaunch", params); + assert_eq!(reply["error"]["data"]["code"], "launch.server_invalid"); + let message = reply["error"]["message"].as_str().unwrap(); + assert!(message.contains("explicit choice has been kept")); + assert!(message.contains("config_win/config.ini")); + assert!(!message.contains("brew")); + assert_eq!( + only_fact(&logs, "operationFailed")["code"], + "launch.server_invalid" + ); + assert_eq!(host.close(), 1); +} + #[test] fn the_backend_reports_restricted_facts_and_suppresses_reads() { let mut host = Host::start(); diff --git a/docs/feature-matrix.md b/docs/feature-matrix.md index 0607775..d9098f9 100644 --- a/docs/feature-matrix.md +++ b/docs/feature-matrix.md @@ -10,6 +10,16 @@ 2026-11-16:Windows 与 Linux 的原生结果以 CI 和后续实机验证为准,本机结果不能推断。 +## 环境检测与下载引导 + +| 能力 | macOS | Windows | Linux | 证据 | +| --- | --- | --- | --- | --- | +| JDT LS 缺失/显式目录无效时显示官方来源、平台配置目录和独立运行 JDK 配置步骤;不静默覆盖 | implemented / pending | implemented / pending | implemented / pending | `backend/src/jdtls.rs`:六种 OS/架构组合的提示测试、Windows 缺失回归、显式配置不回退测试;原生 UI 待验证 | +| 按所选 JDT LS 的最低 Java 版本拒绝过旧运行 JDK,提供可信 JDK 下载与本地选择指引 | implemented / pending | implemented / pending | implemented / pending | `backend/src/launch.rs`:21/25 运行版本检查及写入前拒绝测试;不变更项目 `java` 工具 | +| 自动下载、校验、解压并安装 JDT LS/JDK | not implemented | not implemented | not implemented | API-38 托管下载尚缺;此次仅提供引导,不执行下载内容 | + +跨平台参数测试不等于 Windows/macOS 原生验收;本次后端英文消息本地化仍受 API-37 限制。验证命令、结果及 UI 限制见本次 PR。 + ## Linux 安装包 | 能力 | Linux ARM64 | Linux x64 | 验证入口 | 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 25f057b..7db35c8 100644 --- a/io.github.lithe-idea.java-support/l10n/zh-Hans.json +++ b/io.github.lithe-idea.java-support/l10n/zh-Hans.json @@ -2,7 +2,7 @@ "settings": { "languageServerHome": { "title": "语言服务器目录", - "description": "Eclipse JDT Language Server 的目录,即包含 plugins 和 config 目录的那一层。留空时自动查找:JDTLS_HOME、PATH 上的 jdtls,以及 Homebrew、mason.nvim、Scoop 或 VS Code Java 扩展安装的 JDT LS。", + "description": "选择解压后的 JDT LS 目录,内含 plugins/org.eclipse.equinox.launcher_*.jar 和平台 config.ini(config_win、config_mac[_arm]、config_linux[_arm])。官方下载:https://download.eclipse.org/jdtls/milestones/(解压前核对校验值)。留空自动查找 JDTLS_HOME、PATH、包管理器或 VS Code;不会自动替换已选目录。另在「工具链」设置「JDK for JDT LS」(Java 21+,1.63+ 需 25;https://adoptium.net/temurin/releases/),不影响项目 JDK,修改后重启语言服务器。", "placeholder": "自动查找" }, "heapMaxMB": { diff --git a/io.github.lithe-idea.java-support/plugin.json b/io.github.lithe-idea.java-support/plugin.json index d07c357..0b4e4d6 100644 --- a/io.github.lithe-idea.java-support/plugin.json +++ b/io.github.lithe-idea.java-support/plugin.json @@ -545,7 +545,7 @@ "id": "languageServerHome", "type": "directory", "title": "Language server folder", - "description": "Folder of the Eclipse JDT Language Server, the one that contains plugins and the config folders. Leave empty to find JDT LS installed with Homebrew, mason.nvim, Scoop or the VS Code Java extension, or through JDTLS_HOME or jdtls on PATH.", + "description": "Extracted JDT LS folder with plugins/org.eclipse.equinox.launcher_*.jar and platform config.ini (config_win, config_mac[_arm], config_linux[_arm]). Download: https://download.eclipse.org/jdtls/milestones/ (verify checksum). Leave empty to discover JDTLS_HOME, PATH, package managers, or VS Code; explicit folders are kept. Set \"JDK for JDT LS\" in Toolchains (Java 21+, 25 for 1.63+; https://adoptium.net/temurin/releases/); project JDK stays unchanged.", "default": "", "placeholder": "Automatic", "page": {