Add layout file name in completion for Android Extension properties

#KT-11051 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2017-07-06 18:25:19 +03:00
parent f59859842a
commit 4cef8728d7
16 changed files with 99 additions and 11 deletions
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
class BasicLookupElementFactory(
private val project: Project,
@@ -246,6 +247,16 @@ class BasicLookupElementFactory(
}
fun appendContainerAndReceiverInformation(descriptor: CallableDescriptor, appendTailText: (String) -> Unit) {
val information = CompletionInformationProvider.EP_NAME.extensions.firstNotNullResult {
it.getContainerAndReceiverInformation(descriptor)
}
if (information != null) {
appendTailText(information)
return
}
val extensionReceiver = descriptor.original.extensionReceiverParameter
when {
descriptor is SyntheticJavaPropertyDescriptor -> {
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2017 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.completion
import com.intellij.openapi.extensions.ExtensionPointName
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
interface CompletionInformationProvider {
companion object {
val EP_NAME: ExtensionPointName<CompletionInformationProvider> =
ExtensionPointName.create("org.jetbrains.kotlin.completionInformationProvider")
}
fun getContainerAndReceiverInformation(descriptor: DeclarationDescriptor): String?
}
+1
View File
@@ -77,6 +77,7 @@
<quickFixContributor implementation="org.jetbrains.kotlin.android.quickfix.AndroidQuickFixRegistrar"/>
<projectConfigurator implementation="org.jetbrains.kotlin.android.configure.KotlinAndroidGradleModuleConfigurator"/>
<platformGradleDetector implementation="org.jetbrains.kotlin.android.configure.PlatformAndroidGradleDetector"/>
<completionInformationProvider implementation="org.jetbrains.kotlin.AndroidExtensionsCompletionInformationProvider" />
</extensions>
<project-components>
+2
View File
@@ -45,5 +45,7 @@
interface="org.jetbrains.kotlin.idea.inspections.gradle.KotlinPlatformGradleDetector"/>
<extensionPoint name="scriptHelper"
interface="org.jetbrains.kotlin.script.ScriptHelper"/>
<extensionPoint name="completionInformationProvider"
interface="org.jetbrains.kotlin.idea.completion.CompletionInformationProvider" />
</extensionPoints>
</idea-plugin>