aboutsummaryrefslogtreecommitdiff
path: root/src/Java/JavaDocumentationBuilder.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/JavaDocumentationBuilder.kt')
-rw-r--r--src/Java/JavaDocumentationBuilder.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index c9379386..7443db06 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -11,6 +11,8 @@ import com.intellij.psi.PsiNamedElement
import com.intellij.psi.PsiDocCommentOwner
import com.intellij.psi.PsiClassType
import com.intellij.psi.PsiPrimitiveType
+import com.intellij.psi.PsiModifierListOwner
+import com.intellij.psi.PsiModifier
public class JavaDocumentationBuilder() {
fun appendFile(file: PsiJavaFile, module: DocumentationModule) {
@@ -31,6 +33,9 @@ public class JavaDocumentationBuilder() {
fun DocumentationNode(element: PsiNamedElement, kind: Kind): DocumentationNode {
val docComment = if (element is PsiDocCommentOwner) parseDocumentation(element.getDocComment()) else Content.Empty
val node = DocumentationNode(element.getName() ?: "<anonymous>", docComment, kind)
+ if (element is PsiModifierListOwner) {
+ node.appendModifiers(element)
+ }
return node
}
@@ -67,6 +72,19 @@ public class JavaDocumentationBuilder() {
return node
}
+ fun DocumentationNode.appendModifiers(element: PsiModifierListOwner) {
+ val modifierList = element.getModifierList()
+ if (modifierList == null) {
+ return
+ }
+ PsiModifier.MODIFIERS.forEach {
+ if (modifierList.hasExplicitModifier(it)) {
+ val modifierNode = DocumentationNode(it, Content.Empty, Kind.Modifier)
+ append(modifierNode, DocumentationReference.Kind.Detail)
+ }
+ }
+ }
+
fun DocumentationNode.appendType(psiType: PsiType?, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type) {
if (psiType == null) {
return