KT-32163: Open Quick Documentation when cursor inside function / constructor brackets (#2502)
* Show function docs when cursor is in args of the function call * Show constructor docs when cursor is in args of the constructor call * Show function docs when cursor is in args of the kt function call * Add some tests * Use JavaDocumentationProvider to fetch java method document * Support caret in params #KT-32163 fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
fun testing() {
|
||||
SomeClassWithParen("param", 1<caret>)
|
||||
}
|
||||
|
||||
//INFO: <div class='definition'><pre><a href="psi_element://SomeClassWithParen"><code>SomeClassWithParen</code></a><br><i>@Contract(pure = true)</i>
|
||||
//INFO: public <b>SomeClassWithParen</b>(<a href="psi_element://java.lang.String"><code>String</code></a> str,
|
||||
//INFO: int num)</pre></div><table class='sections'><p><tr><td valign='top' class='section'><p><i>Inferred</i> annotations:</td><td valign='top'><p><i>@org.jetbrains.annotations.Contract(pure = true)</i></td></table>
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Some Java Class
|
||||
*/
|
||||
public class SomeClassWithParen {
|
||||
String str;
|
||||
int num;
|
||||
public SomeClassWithParen(String str, int num) {
|
||||
this.str = str;
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fun ktTestWithParen() {
|
||||
TestWithParen.foo("SomeTest", 1<caret>)
|
||||
}
|
||||
|
||||
//INFO: <div class='definition'><pre><a href="psi_element://TestWithParen"><code>TestWithParen</code></a><br><i>@Contract(value = "_, _ -> new", pure = true)</i>
|
||||
//INFO: <i>@<a href="psi_element://org.jetbrains.annotations.NotNull"><code>NotNull</code></a></i>
|
||||
//INFO: public static <a href="psi_element://java.lang.Object"><code>Object</code></a>[] <b>foo</b>(<a href="psi_element://java.lang.String"><code>String</code></a> str,
|
||||
//INFO: int num)</pre></div><div class='content'>
|
||||
//INFO: Java Method
|
||||
//INFO: <p></div><table class='sections'><p><tr><td valign='top' class='section'><p><i>Inferred</i> annotations:</td><td valign='top'><p><i>@org.jetbrains.annotations.Contract(value = "_, _ -> new", pure = true)</i> <i>@<a href="psi_element://org.jetbrains.annotations.NotNull">org.jetbrains.annotations.NotNull</a></i></td></table>
|
||||
@@ -0,0 +1,8 @@
|
||||
class TestWithParen {
|
||||
/**
|
||||
* Java Method
|
||||
*/
|
||||
public static Object[] foo(String str, int num) {
|
||||
return new Object[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
Some documentation
|
||||
|
||||
* @param a Some int
|
||||
* @param b String
|
||||
*/
|
||||
fun testMethod(a: Int, b: String) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
testMethod(<caret>1, "value")
|
||||
}
|
||||
|
||||
//INFO: <div class='definition'><pre><font color="808080"><i>OnMethodUsageInParen.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></table>
|
||||
Reference in New Issue
Block a user