From d297f4ad8f68a38d448a95173320e57fce694ba6 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Fri, 26 Dec 2014 21:55:28 +0300 Subject: [PATCH] Minor --- .../org/jetbrains/jet/plugin/completion/CompletionSession.kt | 2 +- .../org/jetbrains/jet/plugin/completion/CompletionUtils.kt | 5 +---- .../org/jetbrains/jet/plugin/editor/KotlinTypedHandler.java | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt b/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt index 1f5be276588..a0ed86077d1 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt @@ -194,7 +194,7 @@ abstract class CompletionSessionBase(protected val configuration: CompletionSess } protected fun shouldRunExtensionsCompletion(): Boolean - = configuration.completeNonImportedDeclarations || prefixMatcher.getPrefix().length() >= 3 + = configuration.completeNonImportedDeclarations || prefix.length() >= 3 protected fun getKotlinTopLevelCallables(): Collection = indicesHelper.getTopLevelCallables({ prefixMatcher.prefixMatches(it) }, reference!!.expression) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/CompletionUtils.kt b/idea/src/org/jetbrains/jet/plugin/completion/CompletionUtils.kt index d8d35dc52d3..c19091d6561 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/CompletionUtils.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/CompletionUtils.kt @@ -210,10 +210,7 @@ fun InsertionContext.isAfterDot(): Boolean { fun shouldCompleteThisItems(prefixMatcher: PrefixMatcher): Boolean { val prefix = prefixMatcher.getPrefix() val s = "this@" - return if (prefix.length() > s.length()) - prefix.startsWith(s) - else - s.startsWith(prefix) + return prefix.startsWith(s) || s.startsWith(prefix) } data class ThisItemInfo(val factory: () -> LookupElement, val type: FuzzyType) diff --git a/idea/src/org/jetbrains/jet/plugin/editor/KotlinTypedHandler.java b/idea/src/org/jetbrains/jet/plugin/editor/KotlinTypedHandler.java index d812c8b1d56..c2b8568b233 100644 --- a/idea/src/org/jetbrains/jet/plugin/editor/KotlinTypedHandler.java +++ b/idea/src/org/jetbrains/jet/plugin/editor/KotlinTypedHandler.java @@ -160,6 +160,7 @@ public class KotlinTypedHandler extends TypedHandlerDelegate { } private static boolean endsWith(CharSequence chars, int offset, String text) { + if (offset < text.length()) return false; return chars.subSequence(offset - text.length(), offset).toString().equals(text); }