Don't show several lambda return inlay hints for elvis (KT-22436)
Don't show inlay hints on binary expression operands #KT-22436
This commit is contained in:
@@ -18,7 +18,8 @@ fun provideLambdaReturnValueHints(expression: KtExpression): List<InlayInfo> {
|
|||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expression.parent is KtDotQualifiedExpression || expression.parent is KtSafeQualifiedExpression) {
|
val parent = expression.parent
|
||||||
|
if (parent is KtDotQualifiedExpression || parent is KtSafeQualifiedExpression || parent is KtBinaryExpression) {
|
||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,4 +96,17 @@ class LambdaReturnValueHintsTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
}"""
|
}"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testElvisOperator() {
|
||||||
|
check(
|
||||||
|
"""
|
||||||
|
fun foo() {
|
||||||
|
run {
|
||||||
|
val length: Int? = null
|
||||||
|
<hint text="^run" />length ?: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user