postfix completion: inplace introduce variable: ensure doc committed when handler is started inside writeAction

test: switch on inplace mode in tests
EA-86900 - RE: PostprocessReformattingAspect.beforeDocumentChanged
This commit is contained in:
Anna.Kozlova
2016-10-13 18:47:37 +02:00
parent 5881ca3033
commit 614deb2e24
7 changed files with 28 additions and 2 deletions

View File

@@ -86,6 +86,11 @@ public class IntroduceVariablePostfixTemplate extends PostfixTemplateWithExpress
}
};
}
@Override
protected boolean isInplaceAvailableInTestMode() {
return true;
}
};
}
}

View File

@@ -422,6 +422,7 @@ public class JavaVariableInplaceIntroducer extends AbstractJavaInplaceIntroducer
finally {
myDeleteSelf = true;
}
PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(myEditor.getDocument());
initOccurrencesMarkers();
return variable;
}

View File

@@ -1,5 +1,5 @@
public class Foo {
void m(Object o) {
int foo = 1;<caret>
int <caret>foo = 1;
}
}

View File

@@ -0,0 +1,7 @@
public class Foo {
void m() {
foo(new Runnable() {public void run()}.var<caret>);
}
void foo(Runnable r) {}
}

View File

@@ -0,0 +1,9 @@
public class Foo {
void m() {
Runnable foo = new Runnable() {
public void run()
}; foo(foo);
}
void foo(Runnable r) {}
}

View File

@@ -1,5 +1,5 @@
public class Foo {
void m(Object o) {
boolean foo = o instanceof String;<caret>
boolean <caret>foo = o instanceof String;
}
}

View File

@@ -34,4 +34,8 @@ public class VarPostfixTemplateTest extends PostfixTemplateTestCase {
public void testAdd() {
doTest();
}
public void testAnonymous() {
doTest();
}
}