Skip to content

Commit f41dd22

Browse files
authored
fix: Cannot list multi-module projects properly (#450)
1 parent b20ff89 commit f41dd22

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

jdtls.ext/com.microsoft.jdtls.ext.core/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
44
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
55
<classpathentry kind="src" path="src/"/>
66
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.5.jar"/>

jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/PackageCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,8 @@ public static IJavaProject getJavaProject(String projectUri) {
610610
}
611611

612612
// For multi-module scenario, findContainersForLocationURI API may return a container array,
613-
// need put the result from the nearest project in front.
613+
// need filter out non-Java project and put the result from the nearest project in front.
614+
containers = Arrays.stream(containers).filter(c -> ProjectUtils.isJavaProject(c.getProject())).toArray(IContainer[]::new);
614615
Arrays.sort(containers, (Comparator<IContainer>) (IContainer a, IContainer b) -> {
615616
return a.getFullPath().toPortableString().length() - b.getFullPath().toPortableString().length();
616617
});

0 commit comments

Comments
 (0)