дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02:00
fix(java): Run jdtls with a Lombok agent and show build errors at launch (#9)
* fix(java): Run jdtls with a Lombok agent and show build errors at launch jdtls compiles with ECJ, which only generates Lombok members when the server JVM runs -javaagent:lombok.jar. Nothing put it there, so @Data / @Setter classes lost their accessors and Run launched stale classes with "Unresolved compilation problem" stubs and no explanation. - Projects whose build files mention Lombok get the newest jar: the IDE-managed one (new "Lombok (jdtls agent)" tool, latest release from Maven Central), else ~/.m2 (incl. settings.xml localRepository) or the Gradle cache. Each agent gets its own jdtls workspace so everything is rebuilt with it. - Settings › Languages & Frameworks › Java › JVM options (java.jdt.ls.vmargs); a Lombok agent there wins. - Run (and Debug, as a notification) list the first compile errors when the build has errors, plus a hint when Lombok is missing or older than 1.18.34. Fixes #3 * fix(java): Base the Lombok hint on the agent jdtls actually runs A Lombok agent in Settings › Java › JVM options wins over the managed and cached jars, but the launch hint still looked only at those: with no cached jar it said Lombok was missing, and with an old cached one it blamed that version although jdtls ran the user's. The hint and the startup warning now use the user's agent (version from its file name).
Цей коміт міститься в:
1 джерело
555ea8901f
коміт
acf6931017
24 files changed
+687
-19
No files matched your search
@@ -81,6 +81,15 @@ export function resolveJavaCommand(config: RunConfig, info: JavaLaunchInfo, path
|
||||
return { ...config, command, args };
|
||||
}
|
||||
|
||||
/** Console report of a launch's compile errors (`path:line:col: error: …`) and their likely causes; "" when none. */
|
||||
export function formatCompileErrors(info: JavaLaunchInfo): string {
|
||||
const lines = info.errors.map((e) => `${e.path}:${e.line}:${e.column}: error: ${e.message}`);
|
||||
const more = info.errorCount - info.errors.length;
|
||||
if (more > 0) lines.push(`… and ${more} more error${more === 1 ? "" : "s"} (see the Problems tool window)`);
|
||||
lines.push(...info.hints);
|
||||
return lines.length ? `${lines.join("\n")}\n` : "";
|
||||
}
|
||||
|
||||
/** Joins arguments into one string for adapters that take `args` / `vmArgs` as text (java-debug). */
|
||||
export function joinJavaArgs(args: readonly string[]): string {
|
||||
return args.map((a) => (a === "" ? '""' : /[\s"]/.test(a) ? `"${a.replace(/(["\\])/g, "\\$1")}"` : a)).join(" ");
|
||||
|
||||
Reference in new issue
Заблокувати користувача