Skip to content

Commit

Permalink
fix random completion errors including #634
Browse files Browse the repository at this point in the history
  • Loading branch information
gayanper authored and akurtakov committed Jul 29, 2024
1 parent c0d50ff commit ccbbec8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,12 @@ private CompletionProposal toProposal(IBinding binding, String completion) {

if (kind == CompletionProposal.METHOD_REF) {
var methodBinding = (IMethodBinding) binding;
res.setParameterNames(DOMCompletionEngineMethodDeclHandler.findVariableNames(methodBinding).stream()
.map(String::toCharArray).toArray(i -> new char[i][]));
var paramNames = DOMCompletionEngineMethodDeclHandler.findVariableNames(methodBinding);
if (paramNames.isEmpty()) {
res.setParameterNames(null);
} else {
res.setParameterNames(paramNames.stream().map(String::toCharArray).toArray(i -> new char[i][]));
}
res.setSignature(Signature.createMethodSignature(
Arrays.stream(methodBinding.getParameterTypes()).map(ITypeBinding::getName).map(String::toCharArray)
.map(type -> Signature.createTypeSignature(type, true).toCharArray())
Expand Down Expand Up @@ -564,6 +568,7 @@ private CompletionProposal toPackageProposal(String packageName, ASTNode complet
res.setName(packageName.toCharArray());
res.setCompletion(packageName.toCharArray());
res.setDeclarationSignature(packageName.toCharArray());
res.setSignature(packageName.toCharArray());
configureProposal(res, completing);
return res;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public boolean visit(SimpleType node) {
// actual recoverable type, if not treat the type name as a variable name and search for such variable in
// the context.
var binding = node.resolveBinding();
if(binding == null) {
return super.visit(node);
}

if (!binding.isRecovered()) {
this.foundBinding = binding;
return false;
Expand Down

0 comments on commit ccbbec8

Please sign in to comment.