@@ -65,8 +65,8 @@ class ModsTomlDocumentationProvider : DocumentationProvider {
6565 return null
6666 }
6767
68- val description = entry.description.joinToString( " \n " )
69- return if (description.isNotBlank ()) {
68+ val description = entry.description.filter { it.isNotBlank() }
69+ return if (description.isNotEmpty ()) {
7070 TomlSchemaKeyElement (entry.key, description, psiManager)
7171 } else {
7272 null
@@ -75,7 +75,7 @@ class ModsTomlDocumentationProvider : DocumentationProvider {
7575
7676 override fun generateDoc (element : PsiElement , originalElement : PsiElement ? ): String? {
7777 if (element is TomlSchemaKeyElement ) {
78- return element.description
78+ return generateDoc( element.description)
7979 }
8080
8181 if (element !is TomlKeySegment || ! isModsToml(originalElement)) {
@@ -85,7 +85,7 @@ class ModsTomlDocumentationProvider : DocumentationProvider {
8585 val key = element.parentOfType<TomlKey >() ? : return null
8686 val schema = ModsTomlSchema .get(element.project)
8787 val table = element.parentOfType<TomlKeyValueOwner >()
88- val description = when (val parent = key.parent) {
88+ val lines = when (val parent = key.parent) {
8989 is TomlTableHeader -> {
9090 if (element != parent.key?.segments?.firstOrNull()) {
9191 return null
@@ -102,15 +102,18 @@ class ModsTomlDocumentationProvider : DocumentationProvider {
102102 }
103103 else -> null
104104 }?.takeUnless { it.isEmpty() } ? : return null
105- return DocumentationMarkup . CONTENT_START + description.joinToString( " <br> " ) + DocumentationMarkup . CONTENT_END
105+ return generateDoc(lines)
106106 }
107107
108+ private fun generateDoc (lines : List <String >): String =
109+ DocumentationMarkup .CONTENT_START + lines.joinToString(" <br>" ) + DocumentationMarkup .CONTENT_END
110+
108111 private fun isModsToml (element : PsiElement ? ): Boolean =
109112 element?.containingFile?.virtualFile?.name in ForgeTomlConstants .FILE_NAMES
110113
111114 private class TomlSchemaKeyElement (
112115 val key : String ,
113- val description : String ,
116+ val description : List < String > ,
114117 val psiManager : PsiManager
115118 ) : FakePsiElement() {
116119
0 commit comments