Autoimport items from kotlinx.android.synthetic on completion
This commit is contained in:
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.getJavaFieldDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getJavaMethodDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.core.extension.KotlinIndicesHelperExtension
|
||||
import org.jetbrains.kotlin.idea.imports.importableFqName
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.stubindex.*
|
||||
@@ -145,7 +146,18 @@ public class KotlinIndicesHelper(
|
||||
}
|
||||
.flatMap { index.get(it, project, scope).asSequence() }
|
||||
|
||||
return findSuitableExtensions(declarations, receiverTypes, callTypeAndReceiver.callType)
|
||||
val suitableExtensions = findSuitableExtensions(declarations, receiverTypes, callTypeAndReceiver.callType)
|
||||
|
||||
val additionalDescriptors = ArrayList<CallableDescriptor>(0)
|
||||
|
||||
for (extension in KotlinIndicesHelperExtension.getInstances(project)) {
|
||||
extension.appendExtensionCallables(additionalDescriptors, moduleDescriptor, receiverTypes, nameFilter)
|
||||
}
|
||||
|
||||
return if (additionalDescriptors.isNotEmpty())
|
||||
suitableExtensions + additionalDescriptors
|
||||
else
|
||||
suitableExtensions
|
||||
}
|
||||
|
||||
private fun MutableCollection<String>.addTypeNames(type: KotlinType) {
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.core.extension
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
interface KotlinIndicesHelperExtension {
|
||||
companion object : ProjectExtensionDescriptor<KotlinIndicesHelperExtension>(
|
||||
"org.jetbrains.kotlin.kotlinIndicesHelperExtension", KotlinIndicesHelperExtension::class.java)
|
||||
|
||||
fun appendExtensionCallables(
|
||||
consumer: MutableList<in CallableDescriptor>,
|
||||
moduleDescriptor: ModuleDescriptor,
|
||||
receiverTypes: Collection<KotlinType>,
|
||||
nameFilter: (String) -> Boolean)
|
||||
}
|
||||
Reference in New Issue
Block a user