KT-21213 multiline kdoc - intellij joins lines together without space (#1459)

* KT-21213 multiline kdoc - intellij joins lines together without space

* Use \n directly as a line separator #KT-21213

* Remove unused import #KT-21213
This commit is contained in:
Toshiaki Kameyama
2018-01-05 23:29:11 +09:00
committed by Dmitry Jemerov
parent d51dd97156
commit 19c35ef48c
3 changed files with 25 additions and 1 deletions
@@ -163,7 +163,9 @@ object KDocRenderer {
// Avoid wrapping the entire converted contents in a <p> tag if it's just a single paragraph
val maybeSingleParagraph = markdownNode.children.singleOrNull { it.type != MarkdownTokenTypes.EOL }
return if (maybeSingleParagraph != null && !allowSingleParagraph) {
maybeSingleParagraph.children.joinToString("") { it.toHtml() }
maybeSingleParagraph.children.joinToString("") {
if (it.text == "\n") " " else it.toHtml()
}
}
else {
markdownNode.toHtml()
@@ -0,0 +1,16 @@
/**
* Some documentation
* on two lines.
*
* @param test String
* on two lines
*/
fun testMethod(test: String) {
}
fun test() {
<caret>testMethod("")
}
//INFO: <pre><b>public</b> <b>fun</b> testMethod(test: String): Unit <i>defined in</i> root package <i>in file</i> OnMethodUsageWithMultilineParam.kt</pre><p>Some documentation on two lines.</p>
//INFO: <dl><dt><b>Parameters:</b></dt><dd><code>test</code> - String on two lines</dd></dl>
@@ -258,6 +258,12 @@ public class QuickDocProviderTestGenerated extends AbstractQuickDocProviderTest
doTest(fileName);
}
@TestMetadata("OnMethodUsageWithMultilineParam.kt")
public void testOnMethodUsageWithMultilineParam() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/OnMethodUsageWithMultilineParam.kt");
doTest(fileName);
}
@TestMetadata("OnMethodUsageWithReceiver.kt")
public void testOnMethodUsageWithReceiver() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/OnMethodUsageWithReceiver.kt");