Skip to content

Commit 0e03327

Browse files
Code completion: Use fully qualified name as needed in DEBUG CONSOLE (#504)
1 parent 5174aa3 commit 0e03327

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/CompletionProposalRequestor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.eclipse.jdt.ls.core.internal.handlers.CompletionResponses;
4646
import org.eclipse.lsp4j.CompletionItem;
4747
import org.eclipse.lsp4j.CompletionItemKind;
48+
import org.eclipse.lsp4j.CompletionItemLabelDetails;
4849

4950
import com.google.common.collect.ImmutableSet;
5051
import com.microsoft.java.debug.core.Configuration;
@@ -159,13 +160,26 @@ public CompletionItem toCompletionItem(CompletionProposal proposal, int index) {
159160
data.put(CompletionResolveHandler.DATA_FIELD_PROPOSAL_ID, String.valueOf(index));
160161
$.setData(data);
161162
this.descriptionProvider.updateDescription(proposal, $);
163+
// Use fully qualified name as needed.
164+
$.setInsertText(String.valueOf(proposal.getCompletion()));
162165
adjustCompleteItem($);
163166
$.setSortText(SortTextHelper.computeSortText(proposal));
164167
return $;
165168
}
166169

167170
private void adjustCompleteItem(CompletionItem item) {
168171
if (item.getKind() == CompletionItemKind.Function) {
172+
// Merge the label details into the label property
173+
// because the completion provider in DEBUG CONSOLE
174+
// doesn't support the label details.
175+
CompletionItemLabelDetails labelDetails = item.getLabelDetails();
176+
if (labelDetails != null && StringUtils.isNotBlank(labelDetails.getDetail())) {
177+
item.setLabel(item.getLabel() + labelDetails.getDetail());
178+
}
179+
if (labelDetails != null && StringUtils.isNotBlank(labelDetails.getDescription())) {
180+
item.setLabel(item.getLabel() + " : " + labelDetails.getDescription());
181+
}
182+
169183
String text = item.getInsertText();
170184
if (StringUtils.isNotBlank(text) && !text.endsWith(")")) {
171185
item.setInsertText(text + "()");

0 commit comments

Comments
 (0)