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 4682c41aeda..7d686ed9d55 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
@@ -87,6 +87,7 @@ public class KotlinHighlightingColors {
public static final TextAttributesKey LABEL = createTextAttributesKey("KOTLIN_LABEL");
public static final TextAttributesKey DEBUG_INFO = createTextAttributesKey("KOTLIN_DEBUG_INFO");
public static final TextAttributesKey RESOLVED_TO_ERROR = createTextAttributesKey("KOTLIN_RESOLVED_TO_ERROR");
+ public static final TextAttributesKey NAMED_ARGUMENT = createTextAttributesKey("KOTLIN_NAMED_ARGUMENT");
private KotlinHighlightingColors() {
}
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/SoftKeywordsHighlightingVisitor.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/SoftKeywordsHighlightingVisitor.kt
index 24cffb8934b..fb7253861ad 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/SoftKeywordsHighlightingVisitor.kt
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/SoftKeywordsHighlightingVisitor.kt
@@ -18,10 +18,14 @@ package org.jetbrains.kotlin.idea.highlighter
import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.openapi.application.ApplicationManager
+import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.KtLambdaExpression
+import org.jetbrains.kotlin.psi.KtValueArgument
import org.jetbrains.kotlin.psi.KtVisitorVoid
+import org.jetbrains.kotlin.psi.psiUtil.endOffset
+import org.jetbrains.kotlin.psi.psiUtil.startOffset
internal class SoftKeywordsHighlightingVisitor(private val holder: AnnotationHolder) : KtVisitorVoid() {
@@ -59,4 +63,12 @@ internal class SoftKeywordsHighlightingVisitor(private val holder: AnnotationHol
holder.createInfoAnnotation(arrow, null).textAttributes = KotlinHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW
}
}
+
+ override fun visitArgument(argument: KtValueArgument) {
+ super.visitArgument(argument)
+
+ val argumentName = argument.getArgumentName() ?: return
+ val eq = argument.equalsToken ?: return
+ holder.createInfoAnnotation(TextRange(argumentName.startOffset, eq.endOffset), null).textAttributes = KotlinHighlightingColors.NAMED_ARGUMENT
+ }
}
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.java
index d59ce1a88bb..567e0da7ce7 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.java
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.java
@@ -51,7 +51,10 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
}
}
- highlightVariable(expression, target);
+ if (!(expression.getParent() instanceof KtValueArgumentName)) { // highlighted separately
+ highlightVariable(expression, target);
+ }
+
super.visitSimpleNameExpression(expression);
}
diff --git a/idea/resources/colorScheme/Darcula_Kotlin.xml b/idea/resources/colorScheme/Darcula_Kotlin.xml
index ffd40aadcb0..5bbc682b4eb 100644
--- a/idea/resources/colorScheme/Darcula_Kotlin.xml
+++ b/idea/resources/colorScheme/Darcula_Kotlin.xml
@@ -45,6 +45,11 @@
+
diff --git a/idea/resources/colorScheme/Default_Kotlin.xml b/idea/resources/colorScheme/Default_Kotlin.xml
index e9b6ec4051d..599d559998b 100644
--- a/idea/resources/colorScheme/Default_Kotlin.xml
+++ b/idea/resources/colorScheme/Default_Kotlin.xml
@@ -45,6 +45,11 @@
+
+
+
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt
index c022df1a856..e5b3c0a0a5b 100644
--- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt
@@ -65,7 +65,7 @@ class KotlinColorSettingsPage : ColorSettingsPage {
fun Int?.bar() {
if (this != null) {
- println(toString())
+ println(message = toString())
}
else {
println(this.toString())
@@ -157,7 +157,8 @@ var globalCount
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,
- KotlinBundle.message("options.kotlin.attribute.descriptor.label") to KotlinHighlightingColors.LABEL)
+ KotlinBundle.message("options.kotlin.attribute.descriptor.label") to KotlinHighlightingColors.LABEL,
+ "Named argument" to KotlinHighlightingColors.NAMED_ARGUMENT)
}
override fun getColorDescriptors(): Array = ColorDescriptor.EMPTY_ARRAY
diff --git a/idea/testData/checker/infos/CapturedInInlinedClosure.kt b/idea/testData/checker/infos/CapturedInInlinedClosure.kt
index 60d1402a7b6..73f666b0b21 100644
--- a/idea/testData/checker/infos/CapturedInInlinedClosure.kt
+++ b/idea/testData/checker/infos/CapturedInInlinedClosure.kt
@@ -9,7 +9,7 @@ fun inline() {
run ({ x1 })
val x2 = 1
- run (f = { x2 })
+ run (f = { x2 })
val x3 = 1
run {
diff --git a/idea/testData/highlighter/NamedArguments.kt b/idea/testData/highlighter/NamedArguments.kt
new file mode 100644
index 00000000000..434311d414d
--- /dev/null
+++ b/idea/testData/highlighter/NamedArguments.kt
@@ -0,0 +1,7 @@
+fun foo(p1: Int, p2: String): String {
+ return p2 + p1
+}
+
+fun bar() {
+ foo(1, p2 = "")
+}
diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
index ade4b5f8108..4039b4ad2c9 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
@@ -83,6 +83,12 @@ public class HighlightingTestGenerated extends AbstractHighlightingTest {
doTest(fileName);
}
+ @TestMetadata("NamedArguments.kt")
+ public void testNamedArguments() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/highlighter/NamedArguments.kt");
+ doTest(fileName);
+ }
+
@TestMetadata("Object.kt")
public void testObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/highlighter/Object.kt");