mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
create field from usage: insert braces at selection end (IDEA-102716)
(cherry picked from commit 7eba27508d6e74cad0841013c313c05f6d96f17e)
This commit is contained in:
@@ -108,7 +108,7 @@ public class PsiTypeLookupItem extends LookupItem {
|
||||
context.getDocument().insertString(genericsStart, JavaCompletionUtil.escapeXmlIfNeeded(context, calcGenerics(position, context)));
|
||||
JavaCompletionUtil.shortenReference(context.getFile(), genericsStart - 1);
|
||||
|
||||
int tail = context.getTailOffset();
|
||||
int tail = context.getSelectionEndOffset();
|
||||
String braces = StringUtil.repeat("[]", getBracketsCount());
|
||||
Editor editor = context.getEditor();
|
||||
if (!braces.isEmpty()) {
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Create Field 'fooMoo'" "true"
|
||||
class Barr {
|
||||
private final String s;
|
||||
private final Foo[] fooMoo;
|
||||
|
||||
enum Foo {}
|
||||
|
||||
Barr(String s, Foo... foos) {
|
||||
this.s = s;
|
||||
this.fooMoo = foos;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create Field 'fooMoo'" "true"
|
||||
class Barr {
|
||||
private final String s;
|
||||
|
||||
enum Foo {}
|
||||
|
||||
Barr(String s, Foo... foos) {
|
||||
this.s = s;
|
||||
this.foo<caret>Moo = foos;
|
||||
}
|
||||
}
|
||||
+4
@@ -52,6 +52,10 @@ public class CreateFieldFromUsageTest extends LightQuickFixTestCase{
|
||||
doSingleTest();
|
||||
}
|
||||
|
||||
public void testArrayBraces() throws Exception {
|
||||
doSingleTest();
|
||||
}
|
||||
|
||||
protected void doSingleTest() {
|
||||
doSingleTest(getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user