From 4914ab16d4cae31fa55a3f45173e5d2e7eb02b54 Mon Sep 17 00:00:00 2001 From: Simeon Andreev Date: Fri, 13 Sep 2024 11:27:28 +0200 Subject: [PATCH] [WIP] Fix AbstractJavaCompletionProposal for persistent content assist WIP, DONT MERGE Fixes: #1643 Signed-off-by: Simeon Andreev --- .../ui/text/java/AbstractJavaCompletionProposal.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AbstractJavaCompletionProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AbstractJavaCompletionProposal.java index 7ba992f4aa5..cb46b97a663 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AbstractJavaCompletionProposal.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AbstractJavaCompletionProposal.java @@ -800,13 +800,11 @@ public boolean validate(IDocument document, int offset, DocumentEvent event) { if (!isOffsetValid(offset)) return fIsValidated= false; - fIsValidated= isValidPrefix(getPrefix(document, offset)); + String prefix = getPrefix(document, offset); + fIsValidated= isValidPrefix(prefix); if (fIsValidated && event != null) { - // adapt replacement range to document change - int delta= (event.fText == null ? 0 : event.fText.length()) - event.fLength; - final int newLength= Math.max(getReplacementLength() + delta, 0); - setReplacementLength(newLength); + setReplacementLength(prefix.length()); } return fIsValidated;