run typing/completion outside write action in XmlSyncTagTest

This commit is contained in:
peter
2017-03-01 18:54:13 +01:00
parent fbd745fd34
commit a29c373c90
2 changed files with 6 additions and 18 deletions
@@ -69,7 +69,6 @@ import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -770,11 +769,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
}
}
CommandProcessor.getInstance().executeCommand(getProject(), () -> {
CommandProcessor.getInstance().setCurrentCommandGroupId(myEditor.getDocument());
ActionManagerEx.getInstanceEx().fireBeforeEditorTyping(c, getEditorDataContext());
actionManager.getTypedAction().actionPerformed(getEditor(), c, getEditorDataContext());
}, null, DocCommandGroupId.noneGroupId(myEditor.getDocument()));
ActionManagerEx.getInstanceEx().fireBeforeEditorTyping(c, getEditorDataContext());
actionManager.getTypedAction().actionPerformed(getEditor(), c, getEditorDataContext());
});
}
@@ -1022,7 +1018,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
handler.invokeCompletion(getProject(), editor, invocationCount);
PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); // to compare with file text
}
}, null, null);
}, null, null, getEditor().getDocument());
return getLookupElements();
}
});
@@ -16,9 +16,6 @@
package com.intellij.codeInsight.completion;
import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
@@ -43,10 +40,7 @@ public abstract class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTest
}
protected void type(String toType) {
for (int i = 0; i < toType.length(); i++) {
final char c = toType.charAt(i);
CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> myFixture.type(c)), "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument());
}
myFixture.type(toType);
}
protected void doTestCompletion(final String text, final String toType, final String result) {
@@ -58,10 +52,8 @@ public abstract class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTest
final String toType,
final String result) {
myFixture.configureByText(fileType, text);
CommandProcessor.getInstance().executeCommand(getProject(), () -> {
myFixture.completeBasic();
if (toType != null) myFixture.type(toType);
}, "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument());
myFixture.completeBasic();
if (toType != null) myFixture.type(toType);
myFixture.checkResult(result);
}
}