From 65ca0390de485134d58f35e33471f0ff12cbd730 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Wed, 4 Nov 2026 12:41:34 +0800 Subject: [PATCH] feat(run): choose the JRE and the module of an Application configuration (#1172) Application / Spring Boot configurations found their module only from the main class, so the same class in two modules failed with "Cannot determine the module for main class", and the JVM was always the module's. The form now has JRE (the module's JDK or an installed JDK) and Use classpath of module (found by main class, or a project module, stored as RunConfig.module). Run configuration selects can load their options when shown. Fixes #1153 --- src/features/run/ConfigForm.tsx | 15 ++++++-- src/features/run/jvmTypes.ts | 46 +++++++++++++++++++++++- src/features/run/runConfigTypes.test.tsx | 26 ++++++++++++++ src/features/run/types.ts | 10 ++++-- src/platform/locales/text/zh.json | 5 ++- src/workbench/contributions.ts | 4 ++- 6 files changed, 98 insertions(+), 8 deletions(-) diff --git a/src/features/run/ConfigForm.tsx b/src/features/run/ConfigForm.tsx index 159b04ed..c9c2ef8f 100644 --- a/src/features/run/ConfigForm.tsx +++ b/src/features/run/ConfigForm.tsx @@ -4,7 +4,7 @@ * Before launch list. */ import { parseJavaArgs } from "@/platform/javaLaunch"; -import { useMemo, useRef, useState, type KeyboardEvent, type ReactNode, type RefObject } from "react"; +import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode, type RefObject } from "react"; import clsx from "clsx"; import { isTauri, type BeforeLaunchTask, type RunConfig } from "@/platform/ipc"; import { useWorkflowSettings } from "@/platform/workflowSettings"; @@ -729,9 +729,20 @@ function TypeField({ const tx = useTx(); const root = useProject((s) => s.project?.root ?? null); const listId = `run-field-${field.key}`; + const [loaded, setLoaded] = useState>([]); + useEffect(() => { + let live = true; + void field + .loadOptions?.() + .then((options) => live && setLoaded(options)) + .catch(() => {}); + return () => { + live = false; + }; + }, [field]); if (field.control === "output") return ; if (field.control === "select") { - const options = [...(field.options ?? [])]; + const options = [...(field.options ?? []), ...loaded]; if (value && !options.some((o) => o.value === value)) options.push({ value, label: value }); return (