From 7b1afa1e018738dea7c68c020775f193e4df4be7 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Fri, 26 Feb 2016 11:24:42 +0300 Subject: [PATCH] Rearrange Colors page for Kotlin --- .../kotlin/idea/KotlinBundle.properties | 63 ++++++++++--------- .../highlighter/KotlinColorSettingsPage.kt | 48 +++++++------- 2 files changed, 56 insertions(+), 55 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties index 3173bc1d11f..1c75c2ec429 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties @@ -76,39 +76,40 @@ livetemplate.description.exfun=Extension function livetemplate.description.exval=Extension read-only property livetemplate.description.exvar=Extension read-write property -options.kotlin.attribute.descriptor.builtin.annotation=Built-in annotation -options.kotlin.attribute.descriptor.string.escape=Escape in string and template braces -options.kotlin.attribute.descriptor.closure.braces=Lambda expression braces and arrow -options.kotlin.attribute.descriptor.safe.access=Safe access dot -options.kotlin.attribute.descriptor.arrow=Arrow -options.kotlin.attribute.descriptor.kdoc.comment=KDoc comment -options.kotlin.attribute.descriptor.kdoc.tag=KDoc tag -options.kotlin.attribute.descriptor.kdoc.value=Link in KDoc tag -options.kotlin.attribute.descriptor.object=Object -options.kotlin.attribute.descriptor.enumEntry=Enum entry options.kotlin.attribute.descriptor.annotation=Annotation -options.kotlin.attribute.descriptor.var=Var (mutable variable, parameter or property) -options.kotlin.attribute.descriptor.local.variable=Local variable or value -options.kotlin.attribute.descriptor.captured.variable=Variables and values captured in a closure -options.kotlin.attribute.descriptor.instance.property=Instance property -options.kotlin.attribute.descriptor.package.property=Package-level property -options.kotlin.attribute.descriptor.property.with.backing=Property with backing field -options.kotlin.attribute.descriptor.field=Backing field variable -options.kotlin.attribute.descriptor.extension.property=Extension property -options.kotlin.attribute.descriptor.dynamic.property=Dynamic property -options.kotlin.attribute.descriptor.it=Lambda expression default parameter -options.kotlin.attribute.descriptor.fun=Function declaration -options.kotlin.attribute.descriptor.fun.call=Function call -options.kotlin.attribute.descriptor.dynamic.fun.call=Dynamic function call -options.kotlin.attribute.descriptor.package.fun.call=Package-level function call -options.kotlin.attribute.descriptor.extension.fun.call=Extension function call -options.kotlin.attribute.descriptor.constructor.call=Constructor call -options.kotlin.attribute.descriptor.variable.as.function.call=Variable as function call -options.kotlin.attribute.descriptor.variable.as.function.like.call=Variable as function-like call -options.kotlin.attribute.descriptor.smart.cast=Smart-cast value -options.kotlin.attribute.descriptor.smart.constant=Smart constant -options.kotlin.attribute.descriptor.smart.cast.receiver=Smart-cast implicit receiver +options.kotlin.attribute.descriptor.builtin.annotation=Modifier +options.kotlin.attribute.descriptor.string.escape=String//Escape in string and template braces +options.kotlin.attribute.descriptor.closure.braces=Braces and Operators//Lambda expression braces and arrow +options.kotlin.attribute.descriptor.safe.access=Braces and Operators//Safe access dot +options.kotlin.attribute.descriptor.arrow=Braces and Operators//Arrow +options.kotlin.attribute.descriptor.kdoc.comment=Comments//KDoc//KDoc comment +options.kotlin.attribute.descriptor.kdoc.tag=Comments//KDoc//KDoc tag +options.kotlin.attribute.descriptor.kdoc.value=Comments//KDoc//Link in KDoc tag +options.kotlin.attribute.descriptor.object=Classes and Interfaces//Object +options.kotlin.attribute.descriptor.enumEntry=Classes and Interfaces//Enum entry +options.kotlin.attribute.descriptor.var=Properties and Variables//Var (mutable variable, parameter or property) +options.kotlin.attribute.descriptor.local.variable=Properties and Variables//Local variable or value +options.kotlin.attribute.descriptor.captured.variable=Properties and Variables//Variables and values captured in a closure +options.kotlin.attribute.descriptor.instance.property=Properties and Variables//Instance property +options.kotlin.attribute.descriptor.package.property=Properties and Variables//Package-level property +options.kotlin.attribute.descriptor.property.with.backing=Properties and Variables//Property with backing field +options.kotlin.attribute.descriptor.field=Properties and Variables//Backing field variable +options.kotlin.attribute.descriptor.extension.property=Properties and Variables//Extension property +options.kotlin.attribute.descriptor.dynamic.property=Properties and Variables//Dynamic property +options.kotlin.attribute.descriptor.it=Parameters//Lambda expression default parameter +options.kotlin.attribute.descriptor.fun=Functions//Function declaration +options.kotlin.attribute.descriptor.fun.call=Functions//Function call +options.kotlin.attribute.descriptor.dynamic.fun.call=Functions//Dynamic function call +options.kotlin.attribute.descriptor.package.fun.call=Functions//Package-level function call +options.kotlin.attribute.descriptor.extension.fun.call=Functions//Extension function call +options.kotlin.attribute.descriptor.constructor.call=Functions//Constructor call +options.kotlin.attribute.descriptor.variable.as.function.call=Properties and Variables//Variable as function call +options.kotlin.attribute.descriptor.variable.as.function.like.call=Properties and Variables//Variable as function-like call +options.kotlin.attribute.descriptor.smart.cast=Smart-casts//Smart-cast value +options.kotlin.attribute.descriptor.smart.constant=Smart-casts//Smart constant +options.kotlin.attribute.descriptor.smart.cast.receiver=Smart-casts//Smart-cast implicit receiver options.kotlin.attribute.descriptor.label=Label + migrate.sure=Replace sure() calls by !! in project migrate.class.object.to.companion=Replace 'class' keyword with 'companion' modifier migrate.class.object.to.companion.family=Replace 'class' Keyword with 'companion' Modifier diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt index 1e7f0bb44dc..c022df1a856 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt @@ -25,11 +25,8 @@ import com.intellij.openapi.options.colors.ColorSettingsPage import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.KotlinIcons import org.jetbrains.kotlin.idea.KotlinLanguage - -import javax.swing.* -import java.lang.reflect.Field import java.lang.reflect.Modifier -import java.util.HashMap +import java.util.* class KotlinColorSettingsPage : ColorSettingsPage { override fun getIcon() = KotlinIcons.SMALL_LOGO @@ -38,29 +35,32 @@ class KotlinColorSettingsPage : ColorSettingsPage { override fun getDemoText(): String { return """/* Block comment */ package hello -import kotlin.util.* // line comment +import kotlin.collections.* // line comment /** * Doc comment here for `SomeClass` * @see Iterator#next() */ @Deprecated("Deprecated class") -public 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") +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") val ints = java.util.ArrayList(2) ints[0] = 102 + f() + fl() val myFun = { -> "" }; - var ref = ints.size() - if (!ints.empty) { - ints.forEach { - if (it == null) return - println(it + ref) - } - } + var ref = ints.size + ints.lastIndex + globalCounter + ints.forEach { + if (it == null) return + println(it + ref) + } dyn.dynamicCall() dyn.dynamicProp = 5 } + + override fun hashCode(): Int { + return super.hashCode() * 31 + } } fun Int?.bar() { @@ -72,18 +72,19 @@ fun Int?.bar() { } } -var globalCounter : Int = 5 - get() { - return field - } +var globalCounter : Int = 5 + get = field -public abstract class Abstract { +abstract class Abstract { } object Obj -enum class E { A } - Bad character: \n +enum class E { A, B } + +interface FunctionLike { + operator fun invoke() = 1 +} """ } @@ -130,7 +131,7 @@ var globalCount OptionsBundle.message("options.java.attribute.descriptor.class") to KotlinHighlightingColors.CLASS, OptionsBundle.message("options.java.attribute.descriptor.type.parameter") to KotlinHighlightingColors.TYPE_PARAMETER, OptionsBundle.message("options.java.attribute.descriptor.abstract.class") to KotlinHighlightingColors.ABSTRACT_CLASS, - "Interface" to KotlinHighlightingColors.TRAIT, + OptionsBundle.message("options.java.attribute.descriptor.interface") to KotlinHighlightingColors.TRAIT, KotlinBundle.message("options.kotlin.attribute.descriptor.annotation") to KotlinHighlightingColors.ANNOTATION, KotlinBundle.message("options.kotlin.attribute.descriptor.object") to KotlinHighlightingColors.OBJECT, KotlinBundle.message("options.kotlin.attribute.descriptor.enumEntry") to KotlinHighlightingColors.ENUM_ENTRY, @@ -153,7 +154,6 @@ var globalCount KotlinBundle.message("options.kotlin.attribute.descriptor.constructor.call") to KotlinHighlightingColors.CONSTRUCTOR_CALL, KotlinBundle.message("options.kotlin.attribute.descriptor.variable.as.function.call") to KotlinHighlightingColors.VARIABLE_AS_FUNCTION_CALL, KotlinBundle.message("options.kotlin.attribute.descriptor.variable.as.function.like.call") to KotlinHighlightingColors.VARIABLE_AS_FUNCTION_LIKE_CALL, - OptionsBundle.message("options.java.attribute.descriptor.bad.character") to KotlinHighlightingColors.BAD_CHARACTER, KotlinBundle.message("options.kotlin.attribute.descriptor.smart.cast") to KotlinHighlightingColors.SMART_CAST_VALUE, KotlinBundle.message("options.kotlin.attribute.descriptor.smart.constant") to KotlinHighlightingColors.SMART_CONSTANT, KotlinBundle.message("options.kotlin.attribute.descriptor.smart.cast.receiver") to KotlinHighlightingColors.SMART_CAST_RECEIVER,