From 9dc93709fdbeed0e4de01b336a77ea6359bd24db Mon Sep 17 00:00:00 2001
From: Zarina Kurbatova <zarina.kurbatova@gmail.com>
Date: Tue, 4 Oct 2022 19:10:28 +0300
Subject: [PATCH 1/2] Fix rendering for different IDE versions

---
 .../intellij/plugin/javadoc/UtDocumentationProvider.kt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt
index 027965d7ba..94e89ab536 100644
--- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt
+++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt
@@ -37,14 +37,20 @@ class UtDocumentationProvider : JavaDocumentationProvider() {
         docComment: PsiDocComment,
         comment: PsiDocCommentBase
     ): String? {
-        // add UTBot sections with custom tags.
         val utJavaDocInfoGenerator = UtJavaDocInfoGenerator()
-        return if (baseJavaDocInfo != null && baseJavaDocInfo.contains("utbot")) {
+        // case 1: IDE successfully parsed comment with plugin's custom tags,
+        // and we only need to replace tags names with their messages.
+        return if (baseJavaDocInfo != null && baseJavaDocInfo.contains("@utbot")) {
+            val finalJavaDoc = replaceTagNamesWithMessages(baseJavaDocInfo)
+            JavaDocExternalFilter.filterInternalDocInfo(finalJavaDoc)
+            // case 2: IDE failed to parse plugin's tags, and we need to add them on our own.
+        } else if (baseJavaDocInfo != null && comment.text.contains("@utbot")) {
             val javaDocInfoWithUtSections =
                 utJavaDocInfoGenerator.addUtBotSpecificSectionsToJavaDoc(docComment)
             val finalJavaDoc = replaceTagNamesWithMessages(javaDocInfoWithUtSections)
             JavaDocExternalFilter.filterInternalDocInfo(finalJavaDoc)
         } else {
+            // case 3: comment doesn't contain plugin's tags, so IDE can parse it on its own.
             super.generateRenderedDoc(comment)
         }
     }

From f357bba304b34d6608f449c8d381647d8dc34059 Mon Sep 17 00:00:00 2001
From: Zarina Kurbatova <zarina.kurbatova@gmail.com>
Date: Tue, 4 Oct 2022 19:55:29 +0300
Subject: [PATCH 2/2] add info about IDE version for each case

---
 .../utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt
index 94e89ab536..3f2135a962 100644
--- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt
+++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtDocumentationProvider.kt
@@ -38,12 +38,12 @@ class UtDocumentationProvider : JavaDocumentationProvider() {
         comment: PsiDocCommentBase
     ): String? {
         val utJavaDocInfoGenerator = UtJavaDocInfoGenerator()
-        // case 1: IDE successfully parsed comment with plugin's custom tags,
+        // case 1 (2022.2): IDE successfully parsed comment with plugin's custom tags,
         // and we only need to replace tags names with their messages.
         return if (baseJavaDocInfo != null && baseJavaDocInfo.contains("@utbot")) {
             val finalJavaDoc = replaceTagNamesWithMessages(baseJavaDocInfo)
             JavaDocExternalFilter.filterInternalDocInfo(finalJavaDoc)
-            // case 2: IDE failed to parse plugin's tags, and we need to add them on our own.
+            // case 2 (2022.1 and older): IDE failed to parse plugin's tags, and we need to add them on our own.
         } else if (baseJavaDocInfo != null && comment.text.contains("@utbot")) {
             val javaDocInfoWithUtSections =
                 utJavaDocInfoGenerator.addUtBotSpecificSectionsToJavaDoc(docComment)