Quick doc: show default parameter value

#KT-19069 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-07-26 11:46:13 +02:00
committed by Vladimir Dolzhenko
parent 33150a0809
commit 2162c39ab3
2 changed files with 4 additions and 2 deletions
@@ -58,6 +58,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.resolve.source.getPsi
import org.jetbrains.kotlin.utils.addToStdlib.constant
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -178,6 +179,7 @@ open class KotlinDocumentationProviderCompatBase : AbstractDocumentationProvider
eachAnnotationOnNewLine = true
boldOnlyForNamesInHtml = true
excludedTypeAnnotationClasses = NULLABILITY_ANNOTATIONS
defaultParameterValueRenderer = { (it.source.getPsi() as? KtParameter)?.defaultValue?.text ?: "..." }
}
fun StringBuilder.renderKDoc(contentTag: KDocTag, sections: List<KDocSection>) {
+2 -2
View File
@@ -4,7 +4,7 @@ Some documentation
* @param a Some int
* @param b String
*/
fun testMethod(a: Int, b: String) {
fun testMethod(a: Int, b: String = "default") {
}
@@ -14,5 +14,5 @@ fun test() {
//INFO: <div class='definition'><pre><font color="808080"><i>OnMethodUsage.kt</i></font><br>public fun <b>testMethod</b>(
//INFO: a: Int,
//INFO: b: String
//INFO: b: String = "default"
//INFO: ): Unit</pre></div><div class='content'><p>Some documentation</p></div><table class='sections'><tr><td valign='top' class='section'><p>Params:</td><td valign='top'><p><code>a</code> - Some int<p><code>b</code> - String</td></table>