Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering for different IDE versions #1087

Merged
merged 3 commits into from
Oct 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
onewhl marked this conversation as resolved.
Show resolved Hide resolved
// 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)
}
}
Expand Down