Don't show hint for parameter with explicitly specified type
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ enum class HintType(desc: String, enabled: Boolean) {
|
||||
}
|
||||
|
||||
override fun isApplicable(elem: PsiElement): Boolean = (elem is KtProperty && elem.getReturnTypeReference() == null && elem.isLocal) ||
|
||||
(elem is KtParameter && elem.isLoopParameter)
|
||||
(elem is KtParameter && elem.isLoopParameter && elem.typeReference == null)
|
||||
},
|
||||
|
||||
FUNCTION_HINT("Show function return type hints", false) {
|
||||
|
||||
@@ -46,4 +46,14 @@ class InlayTypeHintsTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
HintType.PROPERTY_HINT.option.set(true)
|
||||
check("""val a = Any()""")
|
||||
}
|
||||
|
||||
fun testLoopParameter() {
|
||||
HintType.LOCAL_VARIABLE_HINT.option.set(true)
|
||||
check("""fun foo() { for (x<hint text=": String" /> in listOf("a")) { } }""")
|
||||
}
|
||||
|
||||
fun testLoopParameterWithExplicitType() {
|
||||
HintType.LOCAL_VARIABLE_HINT.option.set(true)
|
||||
check("""fun foo() { for (x: String in listOf("a")) { } }""")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user