KT-32368 Rework Inline hints settings // HintType cleanup

This commit is contained in:
Andrei Klunnyi
2020-07-08 17:47:56 +02:00
parent d6692a8062
commit 7a69cf587e
2 changed files with 1 additions and 17 deletions
@@ -415,15 +415,7 @@ hints.settings.lambda.receivers.parameters=Implicit receivers and parameters
hints.settings.suspending=Suspending calls
hints.title.property.type.disabled=Do not show property type hints
hints.title.locals.type.disabled=Do not show local variable type hints
hints.title.function.type.disabled=Do not show function return type hints
hints.title.parameter.type.disabled=Do not show parameter type hints
hints.title.argument.name.enabled=Argument name
hints.title.argument.name.disabled=Do not show argument name hints
hints.title.return.expression.disabled=Do not show lambda return expression hints
hints.title.implicit.parameters.disabled=Do not show hints for implicit receivers and parameters of lambdas
hints.title.suspend.calls.disabled=Do not show hints for suspending calls
presentation.text.paren=({0})
presentation.text.in.container.paren=(in {0})
@@ -17,11 +17,10 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
@Suppress("UnstableApiUsage")
enum class HintType(private val showDesc: String, val doNotShowDesc: String, defaultEnabled: Boolean) {
enum class HintType(private val showDesc: String, defaultEnabled: Boolean) {
PROPERTY_HINT(
KotlinBundle.message("hints.settings.types.property"),
KotlinBundle.message("hints.title.property.type.disabled"),
false
) {
override fun provideHints(elem: PsiElement): List<InlayInfo> {
@@ -33,7 +32,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
LOCAL_VARIABLE_HINT(
KotlinBundle.message("hints.settings.types.variable"),
KotlinBundle.message("hints.title.locals.type.disabled"),
false
) {
override fun provideHints(elem: PsiElement): List<InlayInfo> {
@@ -48,7 +46,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
FUNCTION_HINT(
KotlinBundle.message("hints.settings.types.return"),
KotlinBundle.message("hints.title.function.type.disabled"),
false
) {
override fun provideHints(elem: PsiElement): List<InlayInfo> {
@@ -66,7 +63,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
PARAMETER_TYPE_HINT(
KotlinBundle.message("hints.settings.types.parameter"),
KotlinBundle.message("hints.title.parameter.type.disabled"),
false
) {
override fun provideHints(elem: PsiElement): List<InlayInfo> {
@@ -83,7 +79,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
PARAMETER_HINT(
KotlinBundle.message("hints.title.argument.name.enabled"),
KotlinBundle.message("hints.title.argument.name.disabled"),
true
) {
override fun provideHints(elem: PsiElement): List<InlayInfo> {
@@ -96,7 +91,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
LAMBDA_RETURN_EXPRESSION(
KotlinBundle.message("hints.settings.lambda.return"),
KotlinBundle.message("hints.title.return.expression.disabled"),
true
) {
override fun isApplicable(elem: PsiElement) =
@@ -110,7 +104,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
LAMBDA_IMPLICIT_PARAMETER_RECEIVER(
KotlinBundle.message("hints.settings.lambda.receivers.parameters"),
KotlinBundle.message("hints.title.implicit.parameters.disabled"),
true
) {
override fun isApplicable(elem: PsiElement) = elem is KtFunctionLiteral
@@ -125,7 +118,6 @@ enum class HintType(private val showDesc: String, val doNotShowDesc: String, def
SUSPENDING_CALL(
KotlinBundle.message("hints.settings.suspending"),
KotlinBundle.message("hints.title.suspend.calls.disabled"),
false
) {
override fun isApplicable(elem: PsiElement) = elem.isNameReferenceInCall() && ApplicationManager.getApplication().isInternal