Create from Usage: Show target class name in the text of "Create member" quick fix

(cherry picked from commit a51d3fc)
This commit is contained in:
Alexey Sedunov
2016-07-15 00:52:26 +03:00
parent 82bdd1e42b
commit a1e86e8bfa
220 changed files with 234 additions and 229 deletions
@@ -95,19 +95,24 @@ abstract class CreateCallableFromUsageFixBase<E : KtElement>(
if (it.name.isNotEmpty()) {
append(" '")
if (isExtension) {
val callableBuilder =
CallableBuilderConfiguration(callableInfos, element, isExtension = isExtension)
.createBuilder()
val receiverType = callableBuilder
.computeTypeCandidates(callableInfos.first().receiverTypeInfo)
.firstOrNull()
?.theType
if (receiverType != null) {
val callableBuilder =
CallableBuilderConfiguration(callableInfos, element, isExtension = isExtension)
.createBuilder()
val receiverType = callableBuilder
.computeTypeCandidates(callableInfos.first().receiverTypeInfo)
.firstOrNull()
?.theType
if (receiverType != null) {
if (isExtension) {
val receiverTypeText = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.renderType(receiverType)
val isFunctionType = receiverType.constructor.declarationDescriptor is FunctionClassDescriptor
append(if (isFunctionType) "($receiverTypeText)" else receiverTypeText).append('.')
}
else {
receiverType.constructor.declarationDescriptor?.let {
append(IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.renderClassifierName(it)).append('.')
}
}
}
append("${it.name}'")