idea-sbt-plugin icon indicating copy to clipboard operation
idea-sbt-plugin copied to clipboard

Support for ANSI Colour sequences

Open sroebuck opened this issue 13 years ago • 7 comments

Apologies if this has been covered before - I could only see a reference to test colouring.

I have added a logback converter to colourise the WARN and ERROR messages in logs in my project when using SBT. This is really great, but when I view the logs in the console of the idea-sbt-plugin I just see the raw ANSI code sequences.

I know that IDEA's own console supports ANSI colour sequences, it would be great if the idea-sbt-plugin did as well.

sroebuck avatar Nov 15 '11 15:11 sroebuck

"I know that IDEA's own console supports ANSI colour sequences" I didn't know that. Looks like it isn't supported across the board, though:

http://youtrack.jetbrains.net/issue/IDEA-68679 http://youtrack.jetbrains.net/issue/IDEA-69880

I'll poke through the sources and see if I can find a way. Would be great to use this for SBT colorization rather that the current hack.

retronym avatar Nov 15 '11 15:11 retronym

Many thanks for looking into it. Hopefully work on the IntelliJ side will make this easier to enable soon.

Stuart.

Jason Zaugg wrote:

"I know that IDEA's own console supports ANSI colour sequences" I didn't know that. Looks like it isn't supported across the board, though:

http://youtrack.jetbrains.net/issue/IDEA-68679 http://youtrack.jetbrains.net/issue/IDEA-69880

I'll poke through the sources and see if I can find a way. Would be great to use this for SBT colorization rather that the current hack.


Reply to this email directly or view it on GitHub: https://github.com/orfjackal/idea-sbt-plugin/issues/51#issuecomment-2746532

Jason Zaugg mailto:[email protected] 15 November 2011 3:47pm "I know that IDEA's own console supports ANSI colour sequences" I didn't know that. Looks like it isn't supported across the board, though:

http://youtrack.jetbrains.net/issue/IDEA-68679 http://youtrack.jetbrains.net/issue/IDEA-69880

I'll poke through the sources and see if I can find a way. Would be great to use this for SBT colorization rather that the current hack.


Reply to this email directly or view it on GitHub: https://github.com/orfjackal/idea-sbt-plugin/issues/51#issuecomment-2746532

sroebuck avatar Nov 15 '11 15:11 sroebuck

This would also be nice for scalatest output

CaringDev avatar May 29 '13 15:05 CaringDev

Is it still relevant since it is supported by Grep Console plugin?

krasa avatar Apr 20 '14 16:04 krasa

@krasa SBT Console plugin seems to strip ANSI color codes, so your Grep Console cannot see them. =(

@retronym Maybe there could be an option somewhere in SBT Console's settings to turn this stripping off? =)

michalrus avatar May 24 '14 22:05 michalrus

The plugin sets -Dsbt.nologformat=true (or something like that) to instruct SBT not to colorize the output.

retronym avatar May 26 '14 07:05 retronym

@retronym setting this to false in https://github.com/orfjackal/idea-sbt-plugin/blob/756a2ed6b70024f6ab71aed7310f973d17f825b8/sbt-plugin/src/main/java/net/orfjackal/sbt/runner/SbtRunner.java#L55 (or removing this line altogether) doesn't make the plugin output ANSI codes for me. I've tried changing jline.terminal to jline.UnixTerminal, with no success either.

SBT documentation, http://www.scala-sbt.org/release/docs/faq.html#how-do-i-disable-ansi-codes-in-the-output, says:

Sometimes sbt doesn't detect that ansi codes aren't supported and you get output that looks like:

So it seems SBT is doing some checks on its own and may decide to not output ANSI color codes even if -Dsbt.log.noformat=true. =(

michalrus avatar May 27 '14 20:05 michalrus