From 193a404c078f876154dd0fa29a5d08bc15eb356b Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 6 Jul 2016 19:10:32 +0200 Subject: [PATCH] to restore pre-1.0.3 highlighting behavior, inherit "extension function" and "extension property" colors from "static method" and "static field" #KT-12937 Fixed --- .../idea/highlighter/KotlinHighlightingColors.java | 4 ++-- .../kotlin/idea/highlighter/KotlinColorSettingsPage.kt | 10 +++++----- idea/testData/highlighter/JavaTypes.kt | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java index 249c17ff059..c4b1ebec5c4 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java @@ -64,7 +64,7 @@ public class KotlinHighlightingColors { public static final TextAttributesKey INSTANCE_PROPERTY = createTextAttributesKey("KOTLIN_INSTANCE_PROPERTY", DefaultLanguageHighlighterColors.INSTANCE_FIELD); public static final TextAttributesKey PACKAGE_PROPERTY = createTextAttributesKey("KOTLIN_PACKAGE_PROPERTY", DefaultLanguageHighlighterColors.STATIC_FIELD); public static final TextAttributesKey BACKING_FIELD_VARIABLE = createTextAttributesKey("KOTLIN_BACKING_FIELD_VARIABLE"); - public static final TextAttributesKey EXTENSION_PROPERTY = createTextAttributesKey("KOTLIN_EXTENSION_PROPERTY"); + public static final TextAttributesKey EXTENSION_PROPERTY = createTextAttributesKey("KOTLIN_EXTENSION_PROPERTY", DefaultLanguageHighlighterColors.STATIC_FIELD); public static final TextAttributesKey DYNAMIC_PROPERTY_CALL = createTextAttributesKey("KOTLIN_DYNAMIC_PROPERTY_CALL"); // functions @@ -72,7 +72,7 @@ public class KotlinHighlightingColors { public static final TextAttributesKey FUNCTION_DECLARATION = createTextAttributesKey("KOTLIN_FUNCTION_DECLARATION", DefaultLanguageHighlighterColors.FUNCTION_DECLARATION); public static final TextAttributesKey FUNCTION_CALL = createTextAttributesKey("KOTLIN_FUNCTION_CALL", DefaultLanguageHighlighterColors.FUNCTION_CALL); public static final TextAttributesKey PACKAGE_FUNCTION_CALL = createTextAttributesKey("KOTLIN_PACKAGE_FUNCTION_CALL", DefaultLanguageHighlighterColors.STATIC_METHOD); - public static final TextAttributesKey EXTENSION_FUNCTION_CALL = createTextAttributesKey("KOTLIN_EXTENSION_FUNCTION_CALL"); + public static final TextAttributesKey EXTENSION_FUNCTION_CALL = createTextAttributesKey("KOTLIN_EXTENSION_FUNCTION_CALL", DefaultLanguageHighlighterColors.STATIC_METHOD); public static final TextAttributesKey CONSTRUCTOR_CALL = createTextAttributesKey("KOTLIN_CONSTRUCTOR", DefaultLanguageHighlighterColors.FUNCTION_CALL); public static final TextAttributesKey DYNAMIC_FUNCTION_CALL = createTextAttributesKey("KOTLIN_DYNAMIC_FUNCTION_CALL"); public static final TextAttributesKey VARIABLE_AS_FUNCTION_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION"); diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt index 822995d1f49..3a4ea6a8f75 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt @@ -44,22 +44,22 @@ class KotlinColorSettingsPage : ColorSettingsPage { @Deprecated("Deprecated class") private class MyClass<out T : Iterable<T>>(var prop1 : Int) { fun foo(nullable : String?, r : Runnable, f : () -> Int, fl : FunctionLike, dyn: dynamic) { - println("length\nis ${"$"}{nullable?.length} \e") + println("length\nis ${"$"}{nullable?.length} \e") val ints = java.util.ArrayList(2) ints[0] = 102 + f() + fl() val myFun = { -> "" }; var ref = ints.size - ints.lastIndex + globalCounter - ints.forEach { + ints.lastIndex + globalCounter + ints.forEach { if (it == null) return - println(it + ref) + println(it + ref) } dyn.dynamicCall() dyn.dynamicProp = 5 } override fun hashCode(): Int { - return super.hashCode() * 31 + return super.hashCode() * 31 } } diff --git a/idea/testData/highlighter/JavaTypes.kt b/idea/testData/highlighter/JavaTypes.kt index 61810c1e2ad..2fc052891b5 100644 --- a/idea/testData/highlighter/JavaTypes.kt +++ b/idea/testData/highlighter/JavaTypes.kt @@ -1,2 +1,3 @@ @SuppressWarnings class TheClass : Runnable, Thread() { -} \ No newline at end of file + val x = id +}