|
45 | 45 | import org.eclipse.jdt.ls.core.internal.handlers.CompletionResponses; |
46 | 46 | import org.eclipse.lsp4j.CompletionItem; |
47 | 47 | import org.eclipse.lsp4j.CompletionItemKind; |
| 48 | +import org.eclipse.lsp4j.CompletionItemLabelDetails; |
48 | 49 |
|
49 | 50 | import com.google.common.collect.ImmutableSet; |
50 | 51 | import com.microsoft.java.debug.core.Configuration; |
@@ -159,13 +160,26 @@ public CompletionItem toCompletionItem(CompletionProposal proposal, int index) { |
159 | 160 | data.put(CompletionResolveHandler.DATA_FIELD_PROPOSAL_ID, String.valueOf(index)); |
160 | 161 | $.setData(data); |
161 | 162 | this.descriptionProvider.updateDescription(proposal, $); |
| 163 | + // Use fully qualified name as needed. |
| 164 | + $.setInsertText(String.valueOf(proposal.getCompletion())); |
162 | 165 | adjustCompleteItem($); |
163 | 166 | $.setSortText(SortTextHelper.computeSortText(proposal)); |
164 | 167 | return $; |
165 | 168 | } |
166 | 169 |
|
167 | 170 | private void adjustCompleteItem(CompletionItem item) { |
168 | 171 | 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 | + |
169 | 183 | String text = item.getInsertText(); |
170 | 184 | if (StringUtils.isNotBlank(text) && !text.endsWith(")")) { |
171 | 185 | item.setInsertText(text + "()"); |
|
0 commit comments