From a4613ec4a01763c27f122a6d03d6f6a556573902 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 16 Sep 2014 17:58:25 +0400 Subject: [PATCH] Changed completion logic: include non-imported declarations on second press even when prefix is empty --- .../plugin/completion/CompletionSession.kt | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt b/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt index 1de9a220095..1140bce0e8b 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/CompletionSession.kt @@ -148,6 +148,7 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration, KeywordCompletion().complete(parameters, collector) if (completeReference && !shouldRunOnlyTypeCompletion()) { + flushToResultSet() addNonImported() } } @@ -156,17 +157,6 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration, } private fun addNonImported() { - val prefix = prefixMatcher.getPrefix() - - // Try to avoid computing not-imported descriptors for empty prefix - if (prefix.isEmpty()) { - if (!configuration.completeNonImportedDeclarations) return - - if (PsiTreeUtil.getParentOfType(jetReference!!.expression, javaClass()) == null) return - } - - flushToResultSet() - if (shouldRunTopLevelCompletion()) { TypesCompletion(parameters, resolveSession, prefixMatcher).addAllTypes(collector) collector.addDescriptorElements(getKotlinTopLevelDeclarations()) @@ -236,15 +226,6 @@ class SmartCompletionSession(configuration: CompletionSessionConfiguration, para } private fun processNonImported(processor: (DeclarationDescriptor) -> Unit) { - val prefix = prefixMatcher.getPrefix() - - // Try to avoid computing not-imported descriptors for empty prefix - if (prefix.isEmpty()) { - if (!configuration.completeNonImportedDeclarations) return - - if (PsiTreeUtil.getParentOfType(jetReference!!.expression, javaClass()) == null) return - } - if (shouldRunTopLevelCompletion()) { getKotlinTopLevelDeclarations().forEach(processor) }