Renames
This commit is contained in:
@@ -77,18 +77,18 @@ public class KotlinIndicesHelper(
|
|||||||
.flatMap { findTopLevelCallables(it).filter(visibilityFilter) }
|
.flatMap { findTopLevelCallables(it).filter(visibilityFilter) }
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getCallableExtensions(nameFilter: (String) -> Boolean, expression: JetSimpleNameExpression): Collection<CallableDescriptor> {
|
public fun getCallableTopLevelExtensions(nameFilter: (String) -> Boolean, expression: JetSimpleNameExpression): Collection<CallableDescriptor> {
|
||||||
val dataFlowInfo = bindingContext.getDataFlowInfo(expression)
|
val dataFlowInfo = bindingContext.getDataFlowInfo(expression)
|
||||||
|
|
||||||
val functionsIndex = JetTopLevelFunctionFqnNameIndex.getInstance()
|
val functionsIndex = JetTopLevelFunctionFqnNameIndex.getInstance()
|
||||||
val propertiesIndex = JetTopLevelPropertyFqnNameIndex.getInstance()
|
val propertiesIndex = JetTopLevelPropertyFqnNameIndex.getInstance()
|
||||||
|
|
||||||
val sourceFunctionNames = functionsIndex.getAllKeys(project).sequence().map { FqName(it) }
|
val functionFqNames = functionsIndex.getAllKeys(project).sequence().map { FqName(it) }
|
||||||
val sourcePropertyNames = propertiesIndex.getAllKeys(project).sequence().map { FqName(it) }
|
val propertyFqNames = propertiesIndex.getAllKeys(project).sequence().map { FqName(it) }
|
||||||
|
|
||||||
val result = HashSet<CallableDescriptor>()
|
val result = HashSet<CallableDescriptor>()
|
||||||
result.fqNamesToSuitableExtensions(sourceFunctionNames, nameFilter, functionsIndex, expression, bindingContext, dataFlowInfo)
|
result.fqNamesToSuitableExtensions(functionFqNames, nameFilter, functionsIndex, expression, bindingContext, dataFlowInfo)
|
||||||
result.fqNamesToSuitableExtensions(sourcePropertyNames, nameFilter, propertiesIndex, expression, bindingContext, dataFlowInfo)
|
result.fqNamesToSuitableExtensions(propertyFqNames, nameFilter, propertiesIndex, expression, bindingContext, dataFlowInfo)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,11 +219,11 @@ abstract class CompletionSessionBase(protected val configuration: CompletionSess
|
|||||||
protected fun shouldRunExtensionsCompletion(): Boolean
|
protected fun shouldRunExtensionsCompletion(): Boolean
|
||||||
= configuration.completeNonImportedDeclarations || prefix.length() >= 3
|
= configuration.completeNonImportedDeclarations || prefix.length() >= 3
|
||||||
|
|
||||||
protected fun getKotlinTopLevelCallables(): Collection<DeclarationDescriptor>
|
protected fun getTopLevelCallables(): Collection<DeclarationDescriptor>
|
||||||
= indicesHelper.getTopLevelCallables({ prefixMatcher.prefixMatches(it) })
|
= indicesHelper.getTopLevelCallables({ prefixMatcher.prefixMatches(it) })
|
||||||
|
|
||||||
protected fun getKotlinExtensions(): Collection<CallableDescriptor>
|
protected fun getTopLevelExtensions(): Collection<CallableDescriptor>
|
||||||
= indicesHelper.getCallableExtensions({ prefixMatcher.prefixMatches(it) }, reference!!.expression)
|
= indicesHelper.getCallableTopLevelExtensions({ prefixMatcher.prefixMatches(it) }, reference!!.expression)
|
||||||
|
|
||||||
protected fun addAllClasses(kindFilter: (ClassKind) -> Boolean) {
|
protected fun addAllClasses(kindFilter: (ClassKind) -> Boolean) {
|
||||||
AllClassesCompletion(
|
AllClassesCompletion(
|
||||||
@@ -371,12 +371,12 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (completionKind == CompletionKind.ALL) {
|
if (completionKind == CompletionKind.ALL) {
|
||||||
collector.addDescriptorElements(getKotlinTopLevelCallables(), suppressAutoInsertion = true)
|
collector.addDescriptorElements(getTopLevelCallables(), suppressAutoInsertion = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (completionKind == CompletionKind.ALL && shouldRunExtensionsCompletion()) {
|
if (completionKind == CompletionKind.ALL && shouldRunExtensionsCompletion()) {
|
||||||
collector.addDescriptorElements(getKotlinExtensions(), suppressAutoInsertion = true)
|
collector.addDescriptorElements(getTopLevelExtensions(), suppressAutoInsertion = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,11 +431,11 @@ class SmartCompletionSession(configuration: CompletionSessionConfiguration, para
|
|||||||
|
|
||||||
private fun processNonImported(processor: (DeclarationDescriptor) -> Unit) {
|
private fun processNonImported(processor: (DeclarationDescriptor) -> Unit) {
|
||||||
if (shouldRunTopLevelCompletion()) {
|
if (shouldRunTopLevelCompletion()) {
|
||||||
getKotlinTopLevelCallables().forEach(processor)
|
getTopLevelCallables().forEach(processor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldRunExtensionsCompletion()) {
|
if (shouldRunExtensionsCompletion()) {
|
||||||
getKotlinExtensions().forEach(processor)
|
getTopLevelExtensions().forEach(processor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class AutoImportFix(element: JetSimpleNameExpression) : JetHintAction<Jet
|
|||||||
result.addAll(indicesHelper.getTopLevelCallablesByName(referenceName))
|
result.addAll(indicesHelper.getTopLevelCallablesByName(referenceName))
|
||||||
}
|
}
|
||||||
|
|
||||||
result.addAll(indicesHelper.getCallableExtensions({ it == referenceName }, element))
|
result.addAll(indicesHelper.getCallableTopLevelExtensions({ it == referenceName }, element))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user