Changed completion logic: include non-imported declarations on second press even when prefix is empty
This commit is contained in:
@@ -148,6 +148,7 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
|||||||
KeywordCompletion().complete(parameters, collector)
|
KeywordCompletion().complete(parameters, collector)
|
||||||
|
|
||||||
if (completeReference && !shouldRunOnlyTypeCompletion()) {
|
if (completeReference && !shouldRunOnlyTypeCompletion()) {
|
||||||
|
flushToResultSet()
|
||||||
addNonImported()
|
addNonImported()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,17 +157,6 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addNonImported() {
|
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<JetDotQualifiedExpression>()) == null) return
|
|
||||||
}
|
|
||||||
|
|
||||||
flushToResultSet()
|
|
||||||
|
|
||||||
if (shouldRunTopLevelCompletion()) {
|
if (shouldRunTopLevelCompletion()) {
|
||||||
TypesCompletion(parameters, resolveSession, prefixMatcher).addAllTypes(collector)
|
TypesCompletion(parameters, resolveSession, prefixMatcher).addAllTypes(collector)
|
||||||
collector.addDescriptorElements(getKotlinTopLevelDeclarations())
|
collector.addDescriptorElements(getKotlinTopLevelDeclarations())
|
||||||
@@ -236,15 +226,6 @@ class SmartCompletionSession(configuration: CompletionSessionConfiguration, para
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun processNonImported(processor: (DeclarationDescriptor) -> Unit) {
|
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<JetDotQualifiedExpression>()) == null) return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldRunTopLevelCompletion()) {
|
if (shouldRunTopLevelCompletion()) {
|
||||||
getKotlinTopLevelDeclarations().forEach(processor)
|
getKotlinTopLevelDeclarations().forEach(processor)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user