Fix bug when chain is not detected if method expression is used
This commit is contained in:
committed by
Yan Zhulanow
parent
da731b9bae
commit
7cd1baff9d
+5
@@ -55,11 +55,16 @@ abstract class KotlinChainBuilderBase(private val transformer: ChainTransformer<
|
||||
private fun getLatestElementInScope(element: PsiElement?): PsiElement? {
|
||||
var current = element
|
||||
while (current != null) {
|
||||
if (current is KtNamedFunction && current.hasInitializer()) {
|
||||
break
|
||||
}
|
||||
|
||||
val parent = current.parent
|
||||
if (parent is KtBlockExpression || parent is KtLambdaExpression) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
current = parent
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user