From a29c373c901d714870cd35a3567bf4d7d952b3eb Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 1 Mar 2017 18:52:56 +0100 Subject: [PATCH] run typing/completion outside write action in XmlSyncTagTest --- .../fixtures/impl/CodeInsightTestFixtureImpl.java | 10 +++------- .../codeInsight/completion/XmlSyncTagTest.java | 14 +++----------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 27dfeaf2c3f4..4d2a27f71eb8 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -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(); } }); diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java index da49693bc34d..92db7f55b0a5 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java @@ -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); } }