EDU-574 Don't show message about Cython speedups
[idea/community.git] / python / educational-python / src / com / jetbrains / python / edu / debugger / PyEduConsoleInputFilterProvider.java
1 package com.jetbrains.python.edu.debugger;
2
3 import com.intellij.execution.filters.ConsoleInputFilterProvider;
4 import com.intellij.execution.filters.InputFilter;
5 import com.intellij.execution.ui.ConsoleViewContentType;
6 import com.intellij.openapi.project.Project;
7 import com.intellij.openapi.util.Pair;
8 import com.jetbrains.python.debugger.PyRunCythonExtensionsFilter;
9 import org.jetbrains.annotations.NotNull;
10 import org.jetbrains.annotations.Nullable;
11
12 import java.util.Collections;
13 import java.util.List;
14
15 public class PyEduConsoleInputFilterProvider implements ConsoleInputFilterProvider {
16   @NotNull
17   @Override
18   public InputFilter[] getDefaultFilters(@NotNull Project project) {
19     return new InputFilter[]{new InputFilter() {
20       @Nullable
21       @Override
22       public List<Pair<String, ConsoleViewContentType>> applyFilter(String text, ConsoleViewContentType outputType) {
23         if (outputType.equals(ConsoleViewContentType.SYSTEM_OUTPUT) && !text.contains("exit code")) {
24           return Collections.emptyList();
25         }
26         if (text.startsWith(PyRunCythonExtensionsFilter.WARNING_MESSAGE_BEGIN)) {
27           return Collections.emptyList();
28         }
29         if (text.startsWith("pydev debugger")) {
30           return Collections.emptyList();
31         }
32         return Collections.singletonList(Pair.create(text, outputType));
33       }
34     }};
35   }
36 }