mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Rearranger: commit document before processing (IDEA-144637)
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
public class TestClass {
|
||||
public static void main() {
|
||||
}
|
||||
|
||||
static class InnerClass {
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
public class TestClass {
|
||||
static class InnerClass {
|
||||
}
|
||||
<caret>
|
||||
|
||||
public static void main() {
|
||||
}
|
||||
}
|
||||
+4
@@ -102,6 +102,10 @@ public class ReformatCodeActionInEditorTest extends LightPlatformCodeInsightFixt
|
||||
public void testFormatOptimizeRearrangeVcsChanges() {
|
||||
doTest(new ReformatCodeRunOptions(VCS_CHANGED_TEXT).setOptimizeImports(true).setRearrangeCode(true));
|
||||
}
|
||||
|
||||
public void testReformatRearrange_NotBreaksCode_WhenCaretOnEmptyLine() {
|
||||
doTest(new ReformatCodeRunOptions(WHOLE_FILE).setRearrangeCode(true));
|
||||
}
|
||||
|
||||
public void testFormatSelection_DoNotTouchTrailingWhiteSpaces() {
|
||||
//todo actually test is not working, and working test is not working
|
||||
|
||||
@@ -80,8 +80,9 @@ public class RearrangeCodeProcessor extends AbstractLayoutCodeProcessor {
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(file);
|
||||
|
||||
if (document != null && Rearranger.EXTENSION.forLanguage(file.getLanguage()) != null) {
|
||||
Runnable command = prepareRearrangeCommand(file, ranges);
|
||||
PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(document);
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(document);
|
||||
Runnable command = prepareRearrangeCommand(file, ranges);
|
||||
try {
|
||||
CommandProcessor.getInstance().executeCommand(myProject, command, COMMAND_NAME, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user