Change Signature: Do not use local declaration as a context for a type code fragment
This commit is contained in:
+7
-6
@@ -408,12 +408,13 @@ class KotlinChangeSignatureDialog(
|
|||||||
|
|
||||||
private fun getTypeCodeFragmentContext(startFrom: PsiElement): KtElement {
|
private fun getTypeCodeFragmentContext(startFrom: PsiElement): KtElement {
|
||||||
return startFrom.parents.mapNotNull {
|
return startFrom.parents.mapNotNull {
|
||||||
when (it) {
|
when {
|
||||||
is KtNamedFunction -> it.bodyExpression
|
it is KtNamedFunction -> it.bodyExpression
|
||||||
is KtPropertyAccessor -> it.bodyExpression
|
it is KtPropertyAccessor -> it.bodyExpression
|
||||||
is KtConstructor<*> -> it
|
it is KtDeclaration && KtPsiUtil.isLocal(it) -> null
|
||||||
is KtClassOrObject -> it
|
it is KtConstructor<*> -> it
|
||||||
is KtFile -> it
|
it is KtClassOrObject -> it
|
||||||
|
it is KtFile -> it
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}.first()
|
}.first()
|
||||||
|
|||||||
Reference in New Issue
Block a user