mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[Inline Param Name Hints] hints shown for single parameter methods, except setters and well know method names like "println", "get", "contains"...
This commit is contained in:
+39
-3
@@ -140,7 +140,7 @@ public class VarArgTest {
|
||||
}
|
||||
""")
|
||||
|
||||
onLineStartingWith("testBooleanVarargs").assertNoInlays()
|
||||
onLineStartingWith("testBooleanVarargs").assertInlays("test->13")
|
||||
}
|
||||
|
||||
fun `test multiple vararg hint`() {
|
||||
@@ -179,7 +179,7 @@ public class CharSymbol {
|
||||
}
|
||||
""")
|
||||
|
||||
onLineStartingWith("count").assertNoInlays()
|
||||
onLineStartingWith("count").assertInlays("t->1", "fa->false")
|
||||
}
|
||||
|
||||
fun `test do not inline known subsequent parameter names`() {
|
||||
@@ -274,12 +274,44 @@ public class Test {
|
||||
""")
|
||||
|
||||
onLineStartingWith("System")
|
||||
.assertInlays("""x->"AAA"""")
|
||||
.assertNoInlays()
|
||||
|
||||
onLineStartingWith("main(t")
|
||||
.assertInlays("isActive->true", "requestFocus->false", "xoo->2")
|
||||
}
|
||||
|
||||
|
||||
fun `test ignored methods`() {
|
||||
setup("""
|
||||
public class Test {
|
||||
|
||||
public void main() {
|
||||
println("A");
|
||||
print("A");
|
||||
get(1);
|
||||
set(1, new Object());
|
||||
setNewIndex(10);
|
||||
"sss".contains("s");
|
||||
append("sdfsdf");
|
||||
clearStatus(false);
|
||||
}
|
||||
|
||||
void print(String s) {}
|
||||
void println(String s) {}
|
||||
void get(int index) {}
|
||||
void set(int index, Object object) {}
|
||||
void append(String s) {}
|
||||
void clearStatus(boolean updatedRecently) {}
|
||||
|
||||
}
|
||||
""")
|
||||
|
||||
val inlays = getInlays()
|
||||
assertThat(inlays).hasSize(1)
|
||||
|
||||
assertThat(inlays[0].offset).isEqualTo(myFixture.editor.document.text.indexOf("false"))
|
||||
}
|
||||
|
||||
fun `test hints for generic arguments`() {
|
||||
val settings = EditorSettingsExternalizable.getInstance()
|
||||
settings.minArgsToShow = 1
|
||||
@@ -443,6 +475,10 @@ public class VarArgTest {
|
||||
.assertInlays("test->this", "endIndex->1000")
|
||||
}
|
||||
|
||||
private fun getInlays(): List<Inlay> {
|
||||
val editor = myFixture.editor
|
||||
return editor.inlayModel.getInlineElementsInRange(0, editor.document.textLength)
|
||||
}
|
||||
|
||||
private fun onLineStartingWith(text: String): InlayAssert {
|
||||
val range = getLineRangeStartingWith(text)
|
||||
|
||||
Reference in New Issue
Block a user