mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Inlay parameter hints: add hints for enum constructors and new expressions: IDEA-195733
This commit is contained in:
+87
-1
@@ -1066,6 +1066,92 @@ class Test {
|
||||
""")
|
||||
}
|
||||
|
||||
|
||||
fun `test enum parameter names`() {
|
||||
check("""
|
||||
public enum Thingy {
|
||||
ONE(<hint text="green:"/>false, <hint text="striped:"/>true),
|
||||
TWO(<hint text="green:"/>false, <hint text="striped:"/>false),
|
||||
THREE(<hint text="...x:"/>12,32,3,2,32,3,2,3,23);
|
||||
private boolean green;
|
||||
private boolean striped;
|
||||
|
||||
Thingy(final boolean green, final boolean striped) {
|
||||
this.green = green;
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
Thingy(int... x) {
|
||||
}
|
||||
}""")
|
||||
}
|
||||
|
||||
|
||||
fun `test enum parameter names disabled`() {
|
||||
JavaInlayParameterHintsProvider.getInstance().isShowHintsForEnumConstants.set(false)
|
||||
check("""
|
||||
public enum Thingy {
|
||||
ONE(false, true),
|
||||
TWO(false, false),
|
||||
THREE(12,32,3,2,32,3,2,3,23);
|
||||
private boolean green;
|
||||
private boolean striped;
|
||||
|
||||
Thingy(final boolean green, final boolean striped) {
|
||||
this.green = green;
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
Thingy(int... x) {
|
||||
}
|
||||
}""")
|
||||
}
|
||||
|
||||
|
||||
fun `test constructor call`() {
|
||||
JavaInlayParameterHintsProvider.getInstance().isShowHintsForNewExpressions.set(true)
|
||||
check("""
|
||||
public class Test {
|
||||
static class A {
|
||||
A(boolean hardName){}
|
||||
}
|
||||
|
||||
void foo() {
|
||||
new A(<hint text="hardName:"/>true);
|
||||
}
|
||||
}""")
|
||||
}
|
||||
|
||||
|
||||
fun `test constructor call disabled`() {
|
||||
JavaInlayParameterHintsProvider.getInstance().isShowHintsForNewExpressions.set(false)
|
||||
check("""
|
||||
public class Test {
|
||||
static class A {
|
||||
A(boolean hardName){}
|
||||
}
|
||||
|
||||
void foo() {
|
||||
new A(true);
|
||||
}
|
||||
}""")
|
||||
}
|
||||
|
||||
fun `test constructor call with other features`() {
|
||||
JavaInlayParameterHintsProvider.getInstance().isShowHintsForNewExpressions.set(true)
|
||||
JavaInlayParameterHintsProvider.getInstance().ignoreOneCharOneDigitHints.set(true)
|
||||
check("""
|
||||
public class Test {
|
||||
static class A {
|
||||
A(boolean a1, boolean a2){}
|
||||
}
|
||||
|
||||
void foo() {
|
||||
new A(true, false);
|
||||
}
|
||||
}""")
|
||||
}
|
||||
|
||||
fun getHints(): List<String> {
|
||||
val document = myFixture.getDocument(myFixture.file)
|
||||
val manager = ParameterHintsPresentationManager.getInstance()
|
||||
@@ -1074,7 +1160,7 @@ class Test {
|
||||
.getInlineElementsInRange(0, document.textLength)
|
||||
.mapNotNull { manager.getHintText(it) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun assertSingleInlayWithText(expectedText: String) {
|
||||
val inlays = myFixture.editor.inlayModel.getInlineElementsInRange(0, editor.document.textLength)
|
||||
|
||||
Reference in New Issue
Block a user