Suggest postfix templates on lambda expressions

This commit is contained in:
Denis Zharkov
2016-09-29 11:35:54 +03:00
parent 54d9b4bee6
commit ba2d2a036e
7 changed files with 40 additions and 4 deletions
@@ -138,10 +138,15 @@ private class KtExpressionPostfixTemplateSelector(
.filterIsInstance<KtExpression>()
.takeWhile {
it !is KtBlockExpression &&
it !is KtDeclarationWithBody &&
!it.isEffectivelyDeclaration()
}.filter { !it.isSelector && it.parent !is KtUserType && !it.isOperationReference && !KtPsiUtil.isAssignment(it) }
.toList()
}.filter {
!it.isSelector &&
it.parent !is KtUserType &&
!it.isOperationReference &&
!KtPsiUtil.isAssignment(it) &&
// Both KtLambdaExpression and KtFunctionLiteral have the same offset, so we add only one of them -> KtLambdaExpression
it !is KtFunctionLiteral
}.toList()
}
private val KtExpression.isOperationReference: Boolean