doPostponedFormatting after formatting in completion after new (IDEA-CR-14717)

This commit is contained in:
peter
2016-10-20 18:10:31 +02:00
parent 05cf3e43e5
commit 9ffa29ca2d
4 changed files with 28 additions and 0 deletions

View File

@@ -194,6 +194,7 @@ public class ConstructorInsertHandler implements InsertHandler<LookupElementDeco
PsiExpressionList listToReformat = getEnclosingExpressionList(elementAtOffset.getParent());
if (listToReformat != null) {
CodeStyleManager.getInstance(file.getProject()).reformat(listToReformat);
PostprocessReformattingAspect.getInstance(file.getProject()).doPostponedFormatting();
}
}

View File

@@ -0,0 +1,9 @@
abstract class A {
A(int x){}
abstract void foo();
void test(A a){}
{
tes<caret>
}
}

View File

@@ -0,0 +1,10 @@
abstract class A {
A(int x){}
abstract void foo();
void test(A a){}
{
test(new A(<selection>x<caret></selection>) {
});
}
}

View File

@@ -76,4 +76,12 @@ class SignatureCompletionTest extends LightFixtureCompletionTestCase {
checkResult()
}
void testNewAnonymousInMethodArgTemplate() {
configureByTestName()
myFixture.type('new ')
myFixture.complete(CompletionType.SMART)
myFixture.type('\n')
checkResult()
}
}