Missing changes from JDT Index adoption
This commit is contained in:
@@ -110,6 +110,15 @@ public class JavaLangugeClientTest {
|
||||
assertEquals("io.netty.util.Mapping", closeMatches.get(0).getFqName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fuzzyFindAllTypesExcludingSysLibs() throws Exception {
|
||||
List<TypeData> data = client
|
||||
.javaSearchTypes(new JavaSearchParams(project.getLocationURI().toString(), "", true, false))
|
||||
.get(1000, TimeUnit.SECONDS);
|
||||
assertNotNull(data);
|
||||
assertTrue(data.size() > 10000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchPackagesIncludingSysLibs() throws Exception {
|
||||
List<String> packages = client.javaSearchPackages(new JavaSearchParams(project.getLocationURI().toString(), "java.lang", true, true)).get(30, TimeUnit.SECONDS);
|
||||
@@ -124,6 +133,12 @@ public class JavaLangugeClientTest {
|
||||
assertTrue(packages.contains("org.test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchAllPackagesExcludingSysLibs() throws Exception {
|
||||
List<String> packages = client.javaSearchPackages(new JavaSearchParams(project.getLocationURI().toString(), "", true, false)).get(30, TimeUnit.SECONDS);
|
||||
assertTrue(packages.size() > 1000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void map_Subtypes() throws Exception {
|
||||
List<TypeData> data = client
|
||||
|
||||
@@ -58,10 +58,10 @@ public interface STS4LanguageClient extends LanguageClient {
|
||||
@JsonRequest("sts/javaLocation")
|
||||
CompletableFuture<Location> javaLocation(JavaDataParams params);
|
||||
|
||||
@JsonRequest("sts/searchJavaTypes")
|
||||
@JsonRequest("sts/javaSearchTypes")
|
||||
CompletableFuture<List<TypeData>> javaSearchTypes(JavaSearchParams params);
|
||||
|
||||
@JsonRequest("sts/searchJavaPackages")
|
||||
@JsonRequest("sts/javaSearchPackages")
|
||||
CompletableFuture<List<String>> javaSearchPackages(JavaSearchParams params);
|
||||
|
||||
@JsonRequest("sts/javaSubTypes")
|
||||
|
||||
@@ -26,12 +26,14 @@ import org.springframework.ide.vscode.boot.metadata.hints.StsValueHint;
|
||||
import org.springframework.ide.vscode.commons.java.Flags;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.java.IType;
|
||||
import org.springframework.ide.vscode.commons.util.FuzzyMatcher;
|
||||
import org.springframework.ide.vscode.commons.util.StringUtil;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.util.function.Tuples;
|
||||
|
||||
/**
|
||||
* Provides the algorithm for 'class-reference' valueProvider.
|
||||
@@ -147,8 +149,8 @@ public class ClassReferenceProvider extends CachingValueProvider {
|
||||
if (allSubclasses.isEmpty()) {
|
||||
return Flux.empty();
|
||||
} else {
|
||||
return javaProject.getIndex()
|
||||
.fuzzySearchTypes(query, true, false, type -> allSubclasses.contains(type))
|
||||
return Flux.fromIterable(allSubclasses)
|
||||
.map(type -> Tuples.of(type, FuzzyMatcher.matchScore(query, type.getFullyQualifiedName())))
|
||||
.collectSortedList((o1, o2) -> o2.getT2().compareTo(o1.getT2()))
|
||||
.flatMapIterable(l -> l)
|
||||
.map(t -> StsValueHint.create(sourceLinks, javaProject, t.getT1()));
|
||||
|
||||
Reference in New Issue
Block a user