ANSI Escape in Console

Add this URL to your Eclipse Installation to reach this solution's update site.

2022-06 (4.24), 2022-03 (4.23), 2021-12 (4.22), 2021-09 (4.21), 2021-06 (4.20), 2021-03 (4.19), 2020-12 (4.18), 2020-09 (4.17), 2020-06 (4.16), 2020-03 (4.15), 2019-12 (4.14), 2019-09 (4.13), 2019-06 (4.12), 2019-03 (4.11), 2018-12 (4.10), 2018-09 (4.9), Photon (4.8), Oxygen (4.7), Neon (4.6), Mars (4.5), Luna (4.4)

https://www.mihai-nita.net/eclipse

Learn more...
Solution Description

This plugin is not needed starting with Eclipse 2022-09 (4.25)

From Eclipse 2022-09 the official Eclipse Console supports ANSI escape sequences:
https://www.eclipse.org/eclipse/news/4.25/platform.php#debug-ansi-support

I will keep this plugin up and running for older Eclipse versions, until the number of downloads trickles down to almost nothing.

Description

This Eclipse plugin interprets the ANSI escape sequences to color the console output. It works for output text with escape sequences directly from Java, Groovy, C/C++, Perl, Python, or any other Eclipse hosted language that outputs text to the standard output or standard error.

Supports 16 colors / 256 colors / true-colors for foreground and background, color palettes and attributes like bold, italic, underline, invert, conceal, strike, framed.

Unfortunately nothing that changes the content of the output (erase actions), or cursor positioning, because of the way the Eclipse console works.

See https://github.com/mihnita/ansi-econsole/wiki
Release notes: https://github.com/mihnita/ansi-econsole/wiki/Release-Notes
Standard ANSI escape codes: https://en.wikipedia.org/wiki/ANSI_escape_code

And it is open source: https://github.com/mihnita/ansi-econsole
That’s where you can file a bug, ask for a feature, contribute a fix, or just say hi.

Additional Details

Eclipse Versions: 2022-06 (4.24), 2022-03 (4.23), 2021-12 (4.22), 2021-09 (4.21), 2021-06 (4.20), 2021-03 (4.19), 2020-12 (4.18), 2020-09 (4.17), 2020-06 (4.16), 2020-03 (4.15), 2019-12 (4.14), 2019-09 (4.13), 2019-06 (4.12), 2019-03 (4.11), 2018-12 (4.10), 2018-09 (4.9), Photon (4.8), Oxygen (4.7), Neon (4.6), Mars (4.5), Luna (4.4)

Platform Support: Windows, Mac, Linux/GTK

Organization Name: Mihai Nita

Development Status: Production/Stable

Date Created: Tuesday, April 1, 2014 - 01:25

License: Apache 2.0

Date Updated: Wednesday, September 14, 2022 - 05:22

Submitted by: Mihai Nita

Screenshot
Date Ranking Installs Clickthroughs
December 2023 111/558 74 3
November 2023 116/686 353 15
October 2023 107/673 396 18
September 2023 102/663 395 16
August 2023 116/673 312 15
July 2023 93/668 432 12
June 2023 83/669 539 9
May 2023 103/671 446 11
April 2023 95/667 481 8
March 2023 88/686 624 10
February 2023 87/667 549 16
January 2023 85/675 568 14
View Data for all Listings

Unsuccessful Installs

Unsuccessful Installs in the last 7 Days: 3

Download last 500 errors (CSV)

Marketplace Drag to Install Button

By adding the following code below to your website you will be able to add an install button for ANSI Escape in Console.

HTML Code:

Markdown Syntax:

Output:

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

Reviews Add new review

In reply to by Jeff Palmer

It might be this:
https://github.com/mihnita/ansi-econsole/issues/27

Meantime I've put a lot of work on performance, and at this point the performance with the plugin uninstalled / disabled / enabled are very similar, for both light / dark themes.

Trouble is, Eclipse is slow, and is getting worse.

With 2020-09 the performance of Light mode got as slow as the Dark one.
Eclipse 2020-12 adds a new Console setting, "word wrap",  more than 20 times slower for some use cases (like the code from youngm, Dec 2018).

I've added some checks and if the Console settings are known to be performance bottlenecks I warn, and explain where to change them.
I don't have the right to change them myself, as they don't belong to my plugin.

But increassing the buffer size helps (Preferences -- Run/Debug -- Console -- Limit console outpout).
Using 1 million feels a lot better (the default is 80K)

Hi, I'm a high school computer science student in a Java programming class right now. I stumbled upon your pluggin after my teacher said that using colors in the terminal was "impossible". Anyway I love your pluggin, I'm using it to do some cool stuff with ASCII art. I've started to look into ANSI escape sequences, and it looks like there are a lot of cool commands, other than just colors, such as clearing the screen. Now I don't know if it'd be possible to run such a sequence, I've only been coding for 8 weeks. Everytime I've tried to so far to run the clear screen sequence I haven't been sucessful. I was wondering if your pluggin is capable of running these other ANSI sequences. If it's not, I'd be interested in how I could go about making my own pluggin that interfaces between the terminal and the other ANSI sequences. I apologize in advance for my ignorance, thank you for your time. If you would be so kind as to email me, my email is:

christopher.moser@mullenmail.com

In reply to by Chris Moser

I've answered Christopher by email.

But the gist was: I don't think it is possible to implement the complete set of ANSI commands on top of the existing Eclipse Console.
Maybe a couple of things like erase from begin / to end of line / document. Character positioning and changing there would probably be too messy.

But it might be possible to take the TM terminal plugin and either replace the default console with it, or have a way to run applications run in it.

Nothing to add. Works marvelous. If you observe washed colors in Windows (against vivid in the Windows 10 command prompt) you can switch color palette in preferences. I observe xterm as closest to these in command prompt

I love the pluggin, works great, except for 1 small issue.

With ANSI Escape in Console enabled the blue underlining for the stack trace hyperlinks no longer show up.  You can still click on the text and it will take you to the spot in the code but new users do not know it is clickable because it is no longer blue or underlined like it is by default when ANSI Escape in Console is not enabled.

Is there a way to have the blue underlining still display properly via ANSI Escape in Console?  I tried to add ANSI formatting around it but that breaks the hyperlink. 

I'm using it since neon and it just essential. Log is really annoying to read it and it allow to glance at console.

With the latest version of eclipse (2019-03), I cannot change configuration for Ansi Console. In neon, a button at the right of disable/enable plugin opened configuration window. Do you know where is the configuration window ?

In reply to by Florian Melot

Over the last few days I've tested it on:

  • Eclipse 4.12 (2019-06)
  • Eclipse 4.11 (2019-03)
  • Eclipse 4.10 (2018-12)
  • Eclipse 4.9 (2018-09)
  • Eclipse 4.8 (Photon)

All of this combined with all platforms: Linux, Mac OS, and Windows
Did it on x64 platforms only, I don't have anything x32 anymore, sorry.

And it worked everywhere.
The enable / disable button is the same place as before, the top-right of the Console window, and I checked that it works.

I am quite sure I have no breaking changes, to it should (in theory) work all the way back to at least Neon (2016-06), but didn't test.

------------------------

"a button at the right of disable/enable plugin opened configuration window"

I never noticed this before. I do nothing in the plugin code to add such a button.
So I suspect that Eclipse was doing "some magic" to add it.
And maybe that "magic" was removed in 2019-something.

I have always accessed the configuration by going to Windows -- Preferences -- Ansi Console

Thank you,
Mihai

 

In reply to by Florian Melot

Did you manage to solve this?

I've tested the latest version from mars (2015) to latest Eclipse.
Did it on Linux (2 distros), Win 10, and Mac OS.

Should be fine.

There is a small bug where the icon is enabled when you start Eclipse even if in fact the plugin is disabled.
But the status is actually preserved, it starts the way it was when exiting Eclipse. It is just the indicator that is wrong.
I have a bug opened for it, and I'm trying to solve it, because I find it anoying too (even if I almost never disable the plugin :-).

Regards,
Mihai

 

I love the pluggin, works great, except for 1 small issue.

With ANSI Escape in Console enabled the blue underlining for the stack trace hyperlinks no longer show up.  You can still click on the text and it will take you to the spot in the code but new users do not know it is clickable because it is no longer blue or underlined like it is by default when ANSI Escape in Console is not enabled.

Is there a way to have the blue underlining still display properly via ANSI Escape in Console?  I tried to add ANSI formatting around it but that breaks the hyperlink. 

When I drag and drop the install button on my Workspace all I get is a blank (standard) Eclipse Marketplace window opened.

I know it omits 4.10 support, but I know the Spring Tool Suite based on Eclipse 4.10 has it, so I thought I'd manage to get it working.

In reply to by André Barranco

Unfortunately it does not always happen, is pretty rare, so it is hard to debug :-(

Can you please give it another try? I have uipdated the URL, making sure it does not end up in a redirect.

And I made sure to set the falg that Eclipse 4.10 is supported (it worked without changes, it was only a setting in the Marketplace)

Sorry for the troubles,
Mihai

Now the logging of my SPRING BOOT application is no longer scrambled with ANSI control characters. Exactly what I wanted.

The plugin appears to modify the standard console view, instead of adding a new view. No need to (re)configure anything.

I get this error:

Unable to read repository at http /www.miha i-nita.net/ eclipse/content.xml.
Received fatal alert: internal_error

Eclipse IDE for C/C++ Developers, with WICED SDK 3.4.0

Version: Luna Service Release 2 (4.4.2)
Build id: 20150219-0600

In reply to by Daniel Robinson

I switched to a different version of Eclipse and was able to install from the Marketplace to that version's plugins directory.

I copied the JAR file to the plugins directory of the version that failed to load and it works.

There appears to be a version incompatibility between the version of Eclipse used by Cypress and the Marketplace (at least for this package.)

Does not work properly with multiline coloring. I have about 30 lines of output from c++. Let's say the line 10 is the sequence of red color. Then 3 lines that should be red and the code for restoring the default color in the end of the third line. Other lines should have default color. With such output I've got red in different places while scrolling the eclipse's terminal. Sometimes red are first 10 lines, sometimes last part of the text. May be the plugin works only if setting and restoring sequences are localized in the same line?

Oxygen.3a Release (4.7.3a)

In reply to by Andrey Solovjev

Unfortiunately, a known problem, and one that I don't really think I can solve.
https://github.com/mihnita/ansi-econsole/issues/3

It is a limitation in the Eclipse console itself: my plugin only get a line at the time, and when the console buffer gets full the top lines are dropped, the line numbers change, and all context is lost. So when coloring the current line there is no way to know what was set X lines above :-(

I am also anoyed by this bug, I have some idea. But is very hacky, but it might also mess up the performance.

Sorry,
Mihai

 

Could you notify us whenever you have a new release of "ANSI Escape in Console" for Mac OS High Sierra?

I am using Eclipse C++ in Mac OS High Sierra. It seems this pluging removed a part of messages in the console. 

s_asadi83[at]yahoo.con

Spring Boot applications that log using ANSI color codes won't display on the eclipse console. If the text is copied from the console to another app (say Terminal), you can read all the text. It is as though  the text is rendered in the same color as the background color of the conole.

Cannot Install. Facing error
"Unable to read repository at http-www mihai-nita net -eclipse-content xml
peer not authenticated"

Can anyone look into this Please..

In reply to by Valery Mising name

Sorry, I don't have an Ubuntu installed (just Win and Fedora).
I have found a VM, and I can try that.

But a quick look at the sources finds this "suspicious" line in catkin_make and catkin_prepare_release:

# force --no-color if stdout is non-interactive
if not sys.stdout.isatty():
    args.no_color = True

Since Eclipse needs to capture its output, it starts the build with the stdio and stderr redirected.
And that makes sys.stdout.isatty() return False (because the Eclipse console is not really a terminal).

It looks like there is no way to get around this without code changes.
But you can just comment these two lines and it should work.

If you are on Windows, the terminal_color.py also needs some fixing, because it assumes that Windows cannot support ANSI escapes (not true):

if os.name in ['nt']:
    disable_ANSI_colors()

The way I would fix ROS "for real" would be by adding a --force-color flag
(or do what most posix apps do: --color=never|always|auto and also honor an environment variable)

Anyway, if commenting the "if not sys.stdout.isatty():" does not work, please let me know, and I will go ahead and try top setup a working ROS environment.

Thank you,
Mihai