Skip to content

Commit

Permalink
fix: Offer completion results from supertypes (#987)
Browse files Browse the repository at this point in the history
  • Loading branch information
CsCherrYY authored Sep 14, 2021
1 parent 786a32d commit 8dd2c86
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,24 @@ public List<CompletionItem> getCompletionItems(MethodCallExpression containingCa
if (delegateClass == null) {
return Collections.emptyList();
}
return getCompletionItemsFromClass(delegateClass);
return getCompletionItemsFromClass(delegateClass, resolver, new HashSet<>());
}

private List<CompletionItem> getCompletionItemsFromClass(JavaClass javaClass) {
private List<CompletionItem> getCompletionItemsFromClass(JavaClass javaClass, GradleLibraryResolver resolver, Set<String> resultSet) {
if (javaClass == null) {
return Collections.emptyList();
}
List<CompletionItem> results = new ArrayList<>();
for (String superInterface : javaClass.getInterfaceNames()) {
if (resolver.getGradleLibraries().containsKey(superInterface)) {
results.addAll(getCompletionItemsFromClass(resolver.getGradleLibraries().get(superInterface), resolver, resultSet));
}
}
String superClass = javaClass.getSuperclassName();
if (resolver.getGradleLibraries().containsKey(superClass)) {
results.addAll(getCompletionItemsFromClass(resolver.getGradleLibraries().get(superClass), resolver, resultSet));
}
List<String> methodNames = new ArrayList<>();
Set<String> resultSet = new HashSet<>();
Method[] methods = javaClass.getMethods();
for (Method method : methods) {
StringBuilder labelBuilder = new StringBuilder();
Expand Down

0 comments on commit 8dd2c86

Please sign in to comment.