Idea Plugin Console Highlighting

Answered

public class RExecutorRunProfileState implements RunProfileState {
    private final ExecutionEnvironment environment;
    private final RExecutorRunConfigurationOptions options;

    public RExecutorRunProfileState(ExecutionEnvironment environment, RExecutorRunConfigurationOptions options) {
        this.environment = environment;
        this.options = options;
    }

    @Override
    public ExecutionResult execute(Executor executor, @NotNull ProgramRunner<?> runner) {
        final Project project = environment.getProject();

        final String output = toXmlString(result.messages(), true);
       ConsoleView console = createConsole(project);
       console.addMessageFilter(new XMLPatternFilter());
       console.print(output, ConsoleViewContentType.NORMAL_OUTPUT);
       OSProcessHandler processHandler = ProcessHandlerFactory.getInstance()
              .createColoredProcessHandler(new GeneralCommandLine("cmd.exe", "/c", "echo", output));

       ProcessTerminatedListener.attach(processHandler);
       return new DefaultExecutionResult(console, processHandler);
    }

    private ConsoleView createConsole(Project project) {
        return TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    }

I have a plugin that does xsl conversion. How to highlight XML result in Ideas Console? Are there built-in tools for this? Or will you have to write your own filter?

0
3 comments

Hi,

Could you please clarify your use case? Do you want to highlight the XML syntax like in the editor or something else?

0

Hi, yes I want to highlight XML syntax like in an editor.

0

Hi,

I didn't find any API for such a use case.

Regarding filters, I went through existing filters and didn't find any for coloring the syntax in any language. Most of them handle links to source code, installing tools, rerunning process, etc. so this looks like a main API's purpose. You can try to find something similar to your idea on the IntelliJ Platform Explorer:
https://plugins.jetbrains.com/intellij-platform-explorer/extensions?extensions=com.intellij.consoleFilterProvider&pluginId=18577

0

Please sign in to leave a comment.