use of org.eclipse.jdt.core.Signature in project eclipse.jdt.ls by eclipse.
the class CompletionProposalReplacementProvider method appendMethodOverrideReplacement.
/**
* @param completionBuffer
* @param proposal
*/
private void appendMethodOverrideReplacement(StringBuilder completionBuffer, CompletionProposal proposal) {
IDocument document;
try {
document = JsonRpcHelpers.toDocument(this.compilationUnit.getBuffer());
String signature = String.valueOf(proposal.getSignature());
String[] types = Stream.of(Signature.getParameterTypes(signature)).map(t -> Signature.toString(t)).toArray(String[]::new);
String methodName = String.valueOf(proposal.getName());
int offset = proposal.getReplaceStart();
String completion = new String(proposal.getCompletion());
OverrideCompletionProposal overrider = new OverrideCompletionProposal(compilationUnit, methodName, types, completion);
String replacement = overrider.updateReplacementString(document, offset, importRewrite, client.isCompletionSnippetsSupported());
if (replacement != null) {
completionBuffer.append(replacement);
}
} catch (BadLocationException | CoreException e) {
JavaLanguageServerPlugin.logException("Failed to compute override replacement", e);
}
}
Aggregations