Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.eclipse.jdt.ls.core.internal.handlers.CompletionResponses;
import org.eclipse.lsp4j.CompletionItem;
import org.eclipse.lsp4j.CompletionItemKind;
import org.eclipse.lsp4j.CompletionItemLabelDetails;

import com.google.common.collect.ImmutableSet;
import com.microsoft.java.debug.core.Configuration;
Expand Down Expand Up @@ -159,13 +160,26 @@ public CompletionItem toCompletionItem(CompletionProposal proposal, int index) {
data.put(CompletionResolveHandler.DATA_FIELD_PROPOSAL_ID, String.valueOf(index));
$.setData(data);
this.descriptionProvider.updateDescription(proposal, $);
// Use fully qualified name as needed.
$.setInsertText(String.valueOf(proposal.getCompletion()));
adjustCompleteItem($);
$.setSortText(SortTextHelper.computeSortText(proposal));
return $;
}

private void adjustCompleteItem(CompletionItem item) {
if (item.getKind() == CompletionItemKind.Function) {
// Merge the label details into the label property
// because the completion provider in DEBUG CONSOLE
// doesn't support the label details.
CompletionItemLabelDetails labelDetails = item.getLabelDetails();
if (labelDetails != null && StringUtils.isNotBlank(labelDetails.getDetail())) {
item.setLabel(item.getLabel() + labelDetails.getDetail());
}
if (labelDetails != null && StringUtils.isNotBlank(labelDetails.getDescription())) {
item.setLabel(item.getLabel() + " : " + labelDetails.getDescription());
}

String text = item.getInsertText();
if (StringUtils.isNotBlank(text) && !text.endsWith(")")) {
item.setInsertText(text + "()");
Expand Down