Fix completion tests after "cast required" color change (KT-18089)
#KT-18089 Fixed
This commit is contained in:
+3
-3
@@ -77,6 +77,8 @@ class LookupElementFactory(
|
|||||||
val parameter = descriptor.original.valueParameters.singleOrNull() ?: return false
|
val parameter = descriptor.original.valueParameters.singleOrNull() ?: return false
|
||||||
return parameter.type.isFunctionType
|
return parameter.type.isFunctionType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val CAST_REQUIRED_COLOR = JBColor(0x4E4040, 0x969696)
|
||||||
}
|
}
|
||||||
|
|
||||||
val insertHandlerProvider = basicFactory.insertHandlerProvider
|
val insertHandlerProvider = basicFactory.insertHandlerProvider
|
||||||
@@ -272,8 +274,6 @@ class LookupElementFactory(
|
|||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
private val castRequiredColor = JBColor(0x4E4040, 0x969696)
|
|
||||||
|
|
||||||
private fun LookupElement.boldIfImmediate(weight: CallableWeight?): LookupElement {
|
private fun LookupElement.boldIfImmediate(weight: CallableWeight?): LookupElement {
|
||||||
val style = when (weight?.enum) {
|
val style = when (weight?.enum) {
|
||||||
CallableWeightEnum.thisClassMember, CallableWeightEnum.thisTypeExtension -> Style.BOLD
|
CallableWeightEnum.thisClassMember, CallableWeightEnum.thisTypeExtension -> Style.BOLD
|
||||||
@@ -288,7 +288,7 @@ class LookupElementFactory(
|
|||||||
presentation.isItemTextBold = true
|
presentation.isItemTextBold = true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
presentation.itemTextForeground = castRequiredColor
|
presentation.itemTextForeground = CAST_REQUIRED_COLOR
|
||||||
// gray all tail fragments too:
|
// gray all tail fragments too:
|
||||||
val fragments = presentation.tailFragments
|
val fragments = presentation.tailFragments
|
||||||
presentation.clearTail()
|
presentation.clearTail()
|
||||||
|
|||||||
+2
-2
@@ -24,9 +24,9 @@ import com.google.gson.JsonParser
|
|||||||
import com.intellij.codeInsight.completion.CompletionType
|
import com.intellij.codeInsight.completion.CompletionType
|
||||||
import com.intellij.codeInsight.lookup.LookupElement
|
import com.intellij.codeInsight.lookup.LookupElement
|
||||||
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
||||||
import com.intellij.codeInsight.lookup.impl.LookupCellRenderer
|
|
||||||
import com.intellij.ui.JBColor
|
import com.intellij.ui.JBColor
|
||||||
import com.intellij.util.ArrayUtil
|
import com.intellij.util.ArrayUtil
|
||||||
|
import org.jetbrains.kotlin.idea.completion.LookupElementFactory
|
||||||
import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject
|
import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject
|
||||||
import org.jetbrains.kotlin.idea.test.AstAccessControl
|
import org.jetbrains.kotlin.idea.test.AstAccessControl
|
||||||
import org.jetbrains.kotlin.idea.util.module
|
import org.jetbrains.kotlin.idea.util.module
|
||||||
@@ -346,7 +346,7 @@ object ExpectedCompletionUtils {
|
|||||||
}
|
}
|
||||||
val foreground = presentation.itemTextForeground
|
val foreground = presentation.itemTextForeground
|
||||||
if (foreground != JBColor.foreground()) {
|
if (foreground != JBColor.foreground()) {
|
||||||
assert(foreground == LookupCellRenderer.getGrayedForeground(false))
|
assert(foreground == LookupElementFactory.CAST_REQUIRED_COLOR)
|
||||||
if (length > 0) append(" ")
|
if (length > 0) append(" ")
|
||||||
append("grayed")
|
append("grayed")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user