Support for showing rendered doc comments in editor

Fixed #KT-37361
This commit is contained in:
Igor Yakovlev
2020-03-20 23:20:15 +03:00
parent d620802a18
commit a71fd0e6d9
21 changed files with 419 additions and 131 deletions
@@ -0,0 +1,24 @@
/**
* Hello darling
* @author DarkWing Duck
*/
class testClass
/**
* Hello darling outher
* @author Morgana Macawber
*/
class outherClass {
/**
* Hello darling inner
* @author Launchpad McQuack
*/
inner class innerClass {
}
}
// RENDER: <div class='content'><p>Hello darling</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>DarkWing Duck</td></table>
// RENDER: <div class='content'><p>Hello darling outher</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Morgana Macawber</td></table>
// RENDER: <div class='content'><p>Hello darling inner</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Launchpad McQuack</td></table>
@@ -0,0 +1,57 @@
/**
*
* This class has no useful logic; it's just a documentation example.
*
* @param T the type of a member in this class.
* @param X the type of a member in this class.
* @property name is blablabla for name
* @property name2 is blublublu for name2
* @constructor primary ctor for it
*/
class klass<T, X>(val name: String, val name2: String) {
/**
* This method has no useful logic; it's just a documentation example.
*
* @param M the type of a member in this method.
* @param K the type of a member in this group.
* @property[name] is blablabla for name
* @property name2 blublublu for name2
* @throws IndexOutOfBoundsException if something wrong
* @throws ArrayIndexOutOfBoundsException if else something wrong
* @exception java.io.IOException if something else else wrong
* @see method2
* @see method3
* @return [returnMethod] if Duck is Dark
* @author DarkWing Duck
* @suppress something to suppress
* @sample sample
* @sample sample2
*/
fun <M, K> method(name: String, name2: String) {
}
fun method2() {
}
fun method3() {
}
fun returnMethod() {
}
fun sample() {
//this is the sample
}
fun sample2() {
//this is the sample2
}
}
//RENDER: <div class='content'><p>This class has no useful logic; it's just a documentation example.</p></div><table class='sections'><tr><td valign='top' class='section'><p>Params:</td><td valign='top'><p><code>T</code> - the type of a member in this class.<p><code>X</code> - the type of a member in this class.</td><tr><td valign='top' class='section'><p>Properties:</td><td valign='top'><p><code>name</code> - is blablabla for name<p><code>name2</code> - is blublublu for name2</td><tr><td valign='top' class='section'><p>Constructor:</td><td valign='top'>primary ctor for it</td></table>
//RENDER: <div class='content'><p>This method has no useful logic; it's just a documentation example.</p></div><table class='sections'><tr><td valign='top' class='section'><p>Params:</td><td valign='top'><p><code>M</code> - the type of a member in this method.<p><code>K</code> - the type of a member in this group.</td><tr><td valign='top' class='section'><p>Properties:</td><td valign='top'><p><code>name</code> - is blablabla for name<p><code>name2</code> - blublublu for name2</td><tr><td valign='top' class='section'><p>Returns:</td><td valign='top'><a href="psi_element://returnMethod">returnMethod</a> if Duck is Dark</td><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><code><a href="psi_element://IndexOutOfBoundsException"><code>IndexOutOfBoundsException</code></a></code> - if something wrong<p><code><a href="psi_element://ArrayIndexOutOfBoundsException"><code>ArrayIndexOutOfBoundsException</code></a></code> - if else something wrong<p><code><a href="psi_element://java.io.IOException"><code>java.io.IOException</code></a></code> - if something else else wrong</td><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>DarkWing Duck</td><tr><td valign='top' class='section'><p>Suppress:</td><td valign='top'>something to suppress</td><tr><td valign='top' class='section'><p>See Also:</td><td valign='top'><a href="psi_element://method2"><code>method2</code></a>, <a href="psi_element://method3"><code>method3</code></a></td><tr><td valign='top' class='section'><p>Samples:</td><td valign='top'><p><a href="psi_element://sample"><code>sample</code></a><pre><code>//this is the sample</code></pre><p><a href="psi_element://sample2"><code>sample2</code></a><pre><code>//this is the sample2</code></pre></td></table>
@@ -0,0 +1,36 @@
/**
* Hello darling
* @author DarkWing Duck
*/
fun testFun() {}
class outherClass {
/**
* Hello darling instance
* @author Morgana Macawber
*/
fun instanceFun() {
/**
* Hello darling local
* @author Launchpad McQuack
*/
fun localFun() {
if (true) {
/**
* Hello darling superLocal
* @author Reginald Bushroot
*/
fun superLocalFun() {
}
}
}
}
}
// RENDER: <div class='content'><p>Hello darling</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>DarkWing Duck</td></table>
// RENDER: <div class='content'><p>Hello darling instance</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Morgana Macawber</td></table>
// RENDER: <div class='content'><p>Hello darling local</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Launchpad McQuack</td></table>
// RENDER: <div class='content'><p>Hello darling superLocal</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Reginald Bushroot</td></table>
@@ -0,0 +1,41 @@
/**
* Hello darling
* @author DarkWing Duck
*/
val prop = 2
/**
* Hello darling var
* @author Megavolt
*/
var prop = 2
class outherClass {
/**
* Hello darling instance
* @author Morgana Macawber
*/
val instanceProp get() {
/**
* Hello darling local
* @author Launchpad McQuack
*/
val localProp get() {
if (true) {
/**
* Hello darling superLocal
* @author Reginald Bushroot
*/
val superLocalProp = 4
}
}
}
}
// RENDER: <div class='content'><p>Hello darling</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>DarkWing Duck</td></table>
// RENDER: <div class='content'><p>Hello darling var</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Megavolt</td></table>
// RENDER: <div class='content'><p>Hello darling instance</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Morgana Macawber</td></table>
// RENDER: <div class='content'><p>Hello darling local</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Launchpad McQuack</td></table>
// RENDER: <div class='content'><p>Hello darling superLocal</p></div><table class='sections'><tr><td valign='top' class='section'><p>Author:</td><td valign='top'>Reginald Bushroot</td></table>
+1 -1
View File
@@ -9,4 +9,4 @@ fun use() {
//INFO: <div class='definition'><pre><a href="psi_element://E"><code>E</code></a><br>public final fun <b>valueOf</b>(
//INFO: value: String
//INFO: ): <a href="psi_element://E">E</a></pre></div><div class='content'><p>Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)</p></div><table class='sections'><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><code>IllegalArgumentException</code> - if this enum type has no constant with the specified name</td></table>
//INFO: ): <a href="psi_element://E">E</a></pre></div><div class='content'><p>Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)</p></div><table class='sections'><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><code><a href="psi_element://IllegalArgumentException"><code>IllegalArgumentException</code></a></code> - if this enum type has no constant with the specified name</td></table>
@@ -17,4 +17,4 @@ fun test() {
//INFO: <div class='definition'><pre><font color="808080"><i>OnMethodUsageWithReturnAndThrows.kt</i></font><br>public fun <b>testMethod</b>(
//INFO: a: Int,
//INFO: b: String
//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><tr><td valign='top' class='section'><p>Returns:</td><td valign='top'>Return value</td><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><code>IllegalArgumentException</code> - if the weather is bad</td></table>
//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><tr><td valign='top' class='section'><p>Returns:</td><td valign='top'>Return value</td><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><code><a href="psi_element://IllegalArgumentException"><code>IllegalArgumentException</code></a></code> - if the weather is bad</td></table>
+2 -2
View File
@@ -3,7 +3,7 @@ package p
<selection>/**
* Doc comment <caret>here
*/
</selection>fun foo() {
fun foo() {
}
</selection>
fun bar(){}
-9
View File
@@ -1,9 +0,0 @@
package p
<selection>/**
* Doc comment <caret>here
*/
fun foo() {
}
</selection>
fun bar(){}