diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/CompletionProposalRequestor.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/CompletionProposalRequestor.java index 1df752f2..0f2a0bf5 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/CompletionProposalRequestor.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/CompletionProposalRequestor.java @@ -160,9 +160,16 @@ public CompletionItem toCompletionItem(CompletionProposal proposal, int index) { data.put(CompletionResolveHandler.DATA_FIELD_REQUEST_ID, String.valueOf(response.getId())); 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())); + String insertText = String.valueOf(proposal.getCompletion()); + int suffix = proposal.getReplaceEnd() - proposal.getReplaceStart(); + if (suffix > 0) { + $.setInsertText(insertText.substring(suffix)); + } else { + $.setInsertText(insertText); + } adjustCompleteItem($); $.setSortText(SortTextHelper.computeSortText(proposal)); return $;