Search in sources :

Example 1 with SmartEnterProcessor

use of com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor in project intellij-community by JetBrains.

the class PySmartEnterTest method doTest.

public void doTest() {
    myFixture.configureByFile("codeInsight/smartEnter/" + getTestName(true) + ".py");
    final List<SmartEnterProcessor> processors = getSmartProcessors(PythonLanguage.getInstance());
    new WriteCommandAction(myFixture.getProject()) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            final Editor editor = myFixture.getEditor();
            for (SmartEnterProcessor processor : processors) {
                processor.process(myFixture.getProject(), editor, myFixture.getFile());
            }
        }
    }.execute();
    myFixture.checkResultByFile("codeInsight/smartEnter/" + getTestName(true) + "_after.py", true);
}
Also used : WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) Editor(com.intellij.openapi.editor.Editor) SmartEnterProcessor(com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor) Result(com.intellij.openapi.application.Result)

Example 2 with SmartEnterProcessor

use of com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor in project intellij-community by JetBrains.

the class JsonSmartEnterTest method doTest.

public void doTest() {
    myFixture.configureByFile("smartEnter/" + getTestName(false) + ".json");
    final List<SmartEnterProcessor> processors = SmartEnterProcessors.INSTANCE.forKey(JsonLanguage.INSTANCE);
    new WriteCommandAction(myFixture.getProject()) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            final Editor editor = myFixture.getEditor();
            for (SmartEnterProcessor processor : processors) {
                processor.process(myFixture.getProject(), editor, myFixture.getFile());
            }
        }
    }.execute();
    myFixture.checkResultByFile("smartEnter/" + getTestName(false) + "_after.json", true);
}
Also used : WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) Editor(com.intellij.openapi.editor.Editor) SmartEnterProcessor(com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor) Result(com.intellij.openapi.application.Result)

Example 3 with SmartEnterProcessor

use of com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor in project intellij-community by JetBrains.

the class CodeInsightTestUtil method doSmartEnterTest.

public static void doSmartEnterTest(@NotNull final CodeInsightTestFixture fixture, @NotNull final String before, @NotNull final String after) {
    fixture.configureByFile(before);
    final List<SmartEnterProcessor> processors = SmartEnterProcessors.INSTANCE.forKey(fixture.getFile().getLanguage());
    new WriteCommandAction(fixture.getProject()) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            final Editor editor = fixture.getEditor();
            for (SmartEnterProcessor processor : processors) {
                processor.process(getProject(), editor, fixture.getFile());
            }
        }
    }.execute();
    fixture.checkResultByFile(after, false);
}
Also used : WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) Editor(com.intellij.openapi.editor.Editor) SmartEnterProcessor(com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor) Result(com.intellij.openapi.application.Result)

Aggregations

SmartEnterProcessor (com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor)3 Result (com.intellij.openapi.application.Result)3 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)3 Editor (com.intellij.openapi.editor.Editor)3