diff --git a/compiler/frontend/src/org/jetbrains/kotlin/kdoc/lexer/KDocTokens.java b/compiler/frontend/src/org/jetbrains/kotlin/kdoc/lexer/KDocTokens.java
index 327e5c009e0..250cd27a5f7 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/kdoc/lexer/KDocTokens.java
+++ b/compiler/frontend/src/org/jetbrains/kotlin/kdoc/lexer/KDocTokens.java
@@ -66,6 +66,6 @@ public interface KDocTokens {
KDocToken MARKDOWN_ESCAPED_CHAR = new KDocToken("KDOC_MARKDOWN_ESCAPED_CHAR");
- TokenSet KDOC_HIGHLIGHT_TOKENS = TokenSet.create(START, END, LEADING_ASTERISK, TEXT, MARKDOWN_LINK, MARKDOWN_ESCAPED_CHAR);
+ TokenSet KDOC_HIGHLIGHT_TOKENS = TokenSet.create(START, END, LEADING_ASTERISK, TEXT, MARKDOWN_LINK, MARKDOWN_ESCAPED_CHAR, TEXT_OR_LINK);
TokenSet CONTENT_TOKENS = TokenSet.create(TEXT, TAG_NAME, MARKDOWN_LINK, MARKDOWN_ESCAPED_CHAR, TEXT_OR_LINK);
}
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/HighlightingVisitor.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/HighlightingVisitor.java
index d95cf955653..b53d7f0c768 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/HighlightingVisitor.java
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/HighlightingVisitor.java
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.idea.highlighter;
import com.intellij.lang.annotation.AnnotationHolder;
import org.jetbrains.kotlin.psi.JetVisitorVoid;
-abstract class HighlightingVisitor extends JetVisitorVoid {
+public abstract class HighlightingVisitor extends JetVisitorVoid {
protected AnnotationHolder holder;
protected HighlightingVisitor(AnnotationHolder holder) {
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt
index 9f0a985a14b..beb635067d3 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.quickfix.QuickFixes
import kotlin.platform.platformStatic
+import org.jetbrains.kotlin.idea.kdoc.KDocHighlightingVisitor
public open class JetPsiChecker : Annotator, HighlightRangeExtension {
@@ -214,7 +215,8 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension {
private fun getBeforeAnalysisVisitors(holder: AnnotationHolder) = array(
SoftKeywordsHighlightingVisitor(holder),
- LabelsHighlightingVisitor(holder)
+ LabelsHighlightingVisitor(holder),
+ KDocHighlightingVisitor(holder)
)
private fun getAfterAnalysisVisitor(holder: AnnotationHolder, bindingContext: BindingContext) = array(
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/kdoc/KDocHighlightingVisitor.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/kdoc/KDocHighlightingVisitor.kt
new file mode 100644
index 00000000000..80fb0dee477
--- /dev/null
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/kdoc/KDocHighlightingVisitor.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2010-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.idea.kdoc
+
+import org.jetbrains.kotlin.idea.highlighter.HighlightingVisitor
+import com.intellij.lang.annotation.AnnotationHolder
+import com.intellij.psi.PsiElement
+import org.jetbrains.kotlin.kdoc.psi.impl.KDocLink
+import org.jetbrains.kotlin.idea.highlighter.JetHighlightingColors
+
+class KDocHighlightingVisitor(holder: AnnotationHolder): HighlightingVisitor(holder) {
+ override fun visitElement(element: PsiElement) {
+ if (element is KDocLink) {
+ holder.createInfoAnnotation(element, null).setTextAttributes(JetHighlightingColors.KDOC_TAG_VALUE)
+ }
+ super.visitElement(element)
+ }
+}
diff --git a/idea/testData/highlighter/KDoc.kt b/idea/testData/highlighter/KDoc.kt
new file mode 100644
index 00000000000..37be8a3c2d3
--- /dev/null
+++ b/idea/testData/highlighter/KDoc.kt
@@ -0,0 +1,10 @@
+/**
+ * @param x foo and [baz]
+ * @param y bar
+ * @return notALink here
+ */
+fun f(x: Int, y: Int): Int {
+return x + y
+}
+
+fun baz() {}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
index 8377c6165ae..27a6bab3a1b 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
@@ -61,6 +61,12 @@ public class HighlightingTestGenerated extends AbstractHighlightingTest {
doTest(fileName);
}
+ @TestMetadata("KDoc.kt")
+ public void testKDoc() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/highlighter/KDoc.kt");
+ doTest(fileName);
+ }
+
@TestMetadata("Object.kt")
public void testObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/highlighter/Object.kt");