diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/commands/core/CommandCompletionService.kt b/java/java-impl/src/com/intellij/codeInsight/completion/commands/core/CommandCompletionService.kt index 96c91aee92db..9336749bbd4c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/commands/core/CommandCompletionService.kt +++ b/java/java-impl/src/com/intellij/codeInsight/completion/commands/core/CommandCompletionService.kt @@ -150,7 +150,7 @@ class CommandCompletionService( val newList: MutableList = if (index != 0) { val previousBeforeDot = data?.firstOrNull() val last = data?.firstOrNull() - if (previousBeforeDot != null && last != null) { + if (previousBeforeDot != null && last != null && offset - index > 0) { val newString = editor.document.immutableCharSequence.substring(0, offset - index) + editor.document.immutableCharSequence.substring(offset) if (newString.hashCode() == previousBeforeDot.hashcode) { mutableListOf(previousBeforeDot)