Skip to content

Commit

Permalink
[WIP] show completions for statics
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Nov 29, 2024
1 parent e9391f0 commit 901879d
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,35 @@ private void scrapeAccessibleBindings(Bindings scope) {
}
current = current.getParent();
}

// handle favourite members

if (this.requestor.getFavoriteReferences() == null) {
return;
}

List<IType> keysToResolve = new ArrayList<>();
IJavaProject project = this.modelUnit.getJavaProject();
for (String favouriteReference: this.requestor.getFavoriteReferences()) {
if (favouriteReference.endsWith(".*")) { //$NON-NLS-1$
favouriteReference = favouriteReference.substring(0, favouriteReference.length() - 2);
}
String packageName = favouriteReference.substring(0, favouriteReference.lastIndexOf('.'));
String typeName = favouriteReference.substring(favouriteReference.lastIndexOf('.') + 1);
findTypes(typeName, SearchPattern.R_EXACT_MATCH, packageName).forEach(keysToResolve::add);
}
ASTParser parser = ASTParser.newParser(AST.getJLSLatest());
parser.setProject(project);
if (!keysToResolve.isEmpty()) {
IBinding[] bindings = parser.createBindings(keysToResolve.toArray(IType[]::new), this.monitor);
for (IBinding binding : bindings) {
if (binding instanceof ITypeBinding typeBinding) {
processMembers(this.toComplete, typeBinding, scope, true);
} else {
ILog.get().warn("expected the favourite reference to be a Type"); //$NON-NLS-1$
}
}
}
}

private void completeMethodModifiers(MethodDeclaration methodDeclaration) {
Expand Down

0 comments on commit 901879d

Please sign in to comment.