mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 00:16:57 +00:00
feat(jdtls): surface Lombok-generated methods in document symbols, bump jdtls version (#1434)
* feat(jdtls): surface Lombok-generated methods in document symbols JDTLS' DocumentSymbolHandler filtered out every SourceMethod where JDTUtils.isGenerated() was true, so Lombok-synthesised methods (getX/setX, builder(), equals/hashCode/toString, withX, fluent accessors, ...) never reached the LSP client. As a result Serena's symbol-aware tools — find_symbol, get_symbols_overview, replace_symbol_body, insert_before_symbol, insert_after_symbol — could not see, address or edit any Lombok-generated member; only search_for_pattern / replace_content (text-based) worked. Upstream introduced an opt-in preference java.symbols.includeGeneratedCode in eclipse-jdtls/eclipse.jdt.ls#3706 (merged 2026-02-24) and surfaced it through redhat-developer/vscode-java#4335. First vscode-java release with the new JDTLS build is v1.53.0 (2026-02-26). Serena was pinned to v1.42.0-561, well before the fix existed. Changes: - New ls_specific_settings.java.lombok_show_generated setting (default true); forwarded to JDTLS as java.symbols.includeGeneratedCode in initialize params. Older servers ignore the unknown preference key silently. - Bump bundled vscode-java DEFAULT 1.42.0-561 -> 1.54.0-923 (brings JRE 21.0.10, Lombok 1.18.39 and Equinox launcher 1.7.100). INITIAL stays at 1.42.0-561, so per the per-version install-dir convention from #1438 the new build lands in vscode-java-1.54.0-923/ while legacy vscode-java/ caches and any explicit vscode_java_version: '1.42.0-561' override keep working. - New VsixResourcePaths dataclass + INITIAL/DEFAULT_VSCODE_JAVA_PATHS pin the JRE / Lombok / launcher filenames *inside* the VSIX. Without this, bumping the archive would break users on legacy 1.42.0-561 because resource paths inside the archive change between releases. Resolution mirrors SHA pinning: known versions get their pinned paths; any other version raises SolidLSPException with a pointer to upstream-jdtls mode (which derives paths dynamically and needs no pinning). - Drop dead 'static/vscode-java/...' placeholder in initialize params; the real runtimes[] is overwritten below from runtime_dependency_paths .jre_home_path, which is correct in both default-VSIX and upstream-jdtls modes. - Test fixtures: Lombok provided dep in test_repo/pom.xml plus LombokModel / FluentLombokModel / DefaultGreeter covering @Data, @Builder (toBuilder=true), @With, @Delegate, @AllArgsConstructor, @NoArgsConstructor and @Accessors(fluent=true). Regression test in test_java_basic.py asserts every generated-method shape lands in document symbols. Closes #1432
This commit is contained in:
1 parent
3122384822
commit
ba6170bab1
8 files changed
+229
-35
No files matched your search
@@ -11,8 +11,18 @@
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
|
||||
<lombok.version>1.18.38</lombok.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -22,6 +32,13 @@
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package test_repo;
|
||||
|
||||
class DefaultGreeter implements LombokModel.Greeter {
|
||||
@Override
|
||||
public String greet() {
|
||||
return "hi";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String farewell() {
|
||||
return "bye";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package test_repo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/** Verifies prefix-stripped fluent accessors generated by @Accessors(fluent=true). */
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(fluent = true)
|
||||
public class FluentLombokModel {
|
||||
private String host;
|
||||
private String tag;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package test_repo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.With;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
@Data
|
||||
@Builder(toBuilder = true)
|
||||
@With
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LombokModel {
|
||||
private String name;
|
||||
private int age;
|
||||
|
||||
/** Lombok @Delegate forwards every method of Greeter to delegate.* (covers @Delegate generation). */
|
||||
public interface Greeter {
|
||||
String greet();
|
||||
String farewell();
|
||||
}
|
||||
|
||||
@Delegate
|
||||
private final Greeter delegate = new DefaultGreeter();
|
||||
}
|
||||
Reference in new issue
Block a user