feat(jdtls): add automatic Lombok detection and support#8031
feat(jdtls): add automatic Lombok detection and support#8031ilx wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
| const pomPath = path.join(projectRoot, "pom.xml") | ||
| if (await pathExists(pomPath)) { | ||
| const content = await Bun.file(pomPath).text() | ||
| if (/<artifactId>\s*lombok\s*<\/artifactId>/.test(content)) { | ||
| return true | ||
| } | ||
| } |
There was a problem hiding this comment.
Lombok might not be explicitly in the pom.xml. It could be a transient dependency.
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
I just looked into your PR and I think it is needed to also handle gradle plugin for lombok. plugins {
id 'java'
id 'io.freefair.lombok' version "9.2.0"
}I believe syntax is the same for gradle kotlin configuration. I hope it helps. PS: For transitive dependencies you can't detect them with a 100% confidence without using gradle or maven commands. |
| if (await pathExists(wrapperPath)) { | ||
| const args = [ | ||
| // Add Lombok javaagent if enabled | ||
| ...(lombokJarPath ? [`--jvm-arg=-javaagent:${lombokJarPath}`] : []), |
There was a problem hiding this comment.
You should also add config directory for wrapper script : https://github.com/eclipse-jdtls/eclipse.jdt.ls?tab=readme-ov-file#running-from-command-line-with-wrapper-script
- Auto-detect Lombok in pom.xml, build.gradle, build.gradle.kts - Download lombok.jar only when needed - Support both wrapper script and direct Java execution - Add proper error handling for download failures - Respect OPENCODE_DISABLE_LSP_DOWNLOAD flag Improves upon anomalyco#6434 by adding auto-detection instead of always enabling Lombok for all Java projects.
It might be false positive if anyone mentions this string in a comment or unrelated to plugin usage, but that is not very likely and also does not harm.
a704c9e to
e213953
Compare
Summary
Adds automatic Lombok detection and support for the JDTLS language server.
Changes
Improves upon #6434 by adding auto-detection instead of always enabling Lombok for all Java projects.
Fixes #8032