KT-32368 Rework Inline hints settings // preview text
This commit is contained in:
+13
@@ -28,6 +28,19 @@ class KotlinInlayParameterHintsProvider : InlayParameterHintsProvider {
|
|||||||
"*SequenceBuilder.resume(value)", "*SequenceBuilder.yield(value)"
|
"*SequenceBuilder.resume(value)", "*SequenceBuilder.yield(value)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override fun getSettingsPreview(): String {
|
||||||
|
return """
|
||||||
|
fun callsAnotherFun() {
|
||||||
|
anotherFunction(1, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun anotherFunction(a: Int = 10, b: Int = 5): Int {
|
||||||
|
val sum = a + b
|
||||||
|
return sum * 2
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
|
||||||
override fun getHintInfo(element: PsiElement): HintInfo? {
|
override fun getHintInfo(element: PsiElement): HintInfo? {
|
||||||
if (!(HintType.PARAMETER_HINT.isApplicable(element))) return null
|
if (!(HintType.PARAMETER_HINT.isApplicable(element))) return null
|
||||||
val parent: PsiElement = (element as? KtValueArgumentList)?.parent ?: return null
|
val parent: PsiElement = (element as? KtValueArgumentList)?.parent ?: return null
|
||||||
|
|||||||
@@ -83,4 +83,17 @@ class KotlinLambdasHintsProvider : KotlinAbstractHintsProvider<KotlinLambdasHint
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun createSettings(): Settings = Settings()
|
override fun createSettings(): Settings = Settings()
|
||||||
|
|
||||||
|
override val previewText: String? = """
|
||||||
|
val lambda = { i: Int ->
|
||||||
|
i + 10
|
||||||
|
i + 20
|
||||||
|
}
|
||||||
|
|
||||||
|
fun someFun() {
|
||||||
|
GlobalScope.launch {
|
||||||
|
// someSuspendingFun()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
+18
@@ -66,4 +66,22 @@ class KotlinReferencesTypeHintsProvider : KotlinAbstractHintsProvider<KotlinRefe
|
|||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val previewText: String? = """
|
||||||
|
val property = listOf(1, 2, 3).filter { num -> num % 2 == 0 }
|
||||||
|
|
||||||
|
fun someFun(arg: Int) = print(arg)
|
||||||
|
|
||||||
|
fun anotherFun(a: Int = 10, b: Int = 5): Int {
|
||||||
|
val variable = a + b
|
||||||
|
return variable * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
fun yetAnotherFun() {
|
||||||
|
Stream.of(1, 2, 3)
|
||||||
|
.map { i -> i + 12 }
|
||||||
|
.filter { i -> i % 2 == 0 }
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user