KT-18979 Add val to proper place for 'Add val/var' intent
This commit is contained in:
committed by
asedunov
parent
f01de3a935
commit
1cab0d09ab
+1
-1
@@ -46,7 +46,7 @@ interface AddValVarToConstructorParameterAction {
|
||||
fun invoke(element: KtParameter, editor: Editor?) {
|
||||
val project = element.project
|
||||
|
||||
element.addAfter(KtPsiFactory(project).createValKeyword(), null)
|
||||
element.addBefore(KtPsiFactory(project).createValKeyword(), element.nameIdentifier)
|
||||
|
||||
if (editor == null) return
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Add val/var to parameter 'x'" "true"
|
||||
class Foo(vararg <caret>x: Int, val y: Int) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Add val/var to parameter 'x'" "true"
|
||||
class Foo(vararg val<caret> x: Int, val y: Int) {
|
||||
|
||||
}
|
||||
@@ -793,6 +793,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("addValAfterVarArg.kt")
|
||||
public void testAddValAfterVarArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addValVar/addValAfterVarArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInAddValVar() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/addValVar"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user