Eclipse editor line color - eclipse

Is there any way to make Eclipse set the color of the line beginning with some expression to a specified value?
In my code I got lots of working "Log" calls which I want to save until any production-like version occurs, but they make it hard to read the code. So I need theses calls (lines, or it would be better if it would be full construction until ";") to be displayed in some other color, like light gray.

You could add a Task Tag, like "TODO", but use "log." or something like that. And the task tag lines appear in a user-specified color.

Related

View text or log files using color escape sequences as colored in vscode

I am writing some logs and graphs to .log and .txt files in NodeJS. I use chalk to color my logs and help things stand out. I am also using asciichart to generate some lo-fi but very helpful graphs.
As far as I understand both of these libraries use escape sequences to color text, i.e. \x1b[32m for green, \x1b[31m for red, etc. These escape sequences, when interpereted by a terminal console, get printed as actual color. This is nicely explained in this answer to the question "How to change node.js's console font color?"
I would like to be able to see similarly colored text within an actual text file. Obviously a text file cannot show colors, but I am wondering if a way exists to view a text file such that the escape characters are processed/parsed, and colors are shown, in the same way that happens within a terminal console.
For example, writing a colored asciichart graph to a file looks like this in vscode:
Obviously as a text file \x1b[34m╭\x1b[0m\x1b[34m─\x1b[0m would just show up as such.
Does anyknow know of any vscode extensions, vscode custom language settings, or any other text viewers for that matter, that would be able to view a .txt or .log file, such that the escape characters are used to color the text, rather than be shown as a big text mess above? (Could this feasibly be written as a vscode extension / custom language setting?). While the question https://unix.stackexchange.com/questions/262185/display-file-with-ansi-colors has some nice hints, it ultimately only shows how to view the file in the terminal, not in a more ui-friendly file-viewer.
Well I asked this a bit prematurely. It turns out ANSI Colors vscode extension does exactly this. I'll leave this here for anyone that may have the same needs in the future.

How to change iPython error highlighting color

I'm using IPython with iterm2 in macOS. I had never had issues before with the color scheme, but this time when an exception occurs, it highlights certain parts in a color combination that I find very hard to read. I've tried with different color setups in iterm and also adjusting highlighting_style and colors in the ipython_config.py file, without much luck. I've seen there is an option to set specific colors highlighting_style_overrides but I haven't been lucky finding the right pygments option for this.
See Position below. This is the best contrast setup I've achieved, I still find hard it to read without focusing.
There is an open issue regarding this: https://github.com/ipython/ipython/issues/13446
Here is the commit which introduced this change:
https://github.com/ipython/ipython/commit/3026c205487897f6874b2ff580fe0be33e36e033
To get the file path on your system, run the following:
import IPython, os
os.path.join(os.path.dirname(IPython.__file__), 'core/ultratb.py')
Finally, open the file and look for:
style = stack_data.style_with_executing_node(style, "bg:ansiyellow")
For the time being, you can manually patch it by changing bg:ansiyellow to something that works best given your color scheme, e.g. bg:ansired or bg:#ff0000.
Here's an option you can drop in your ipython_config.py to duck punch in a better background color:
try:
from IPython.core import ultratb
ultratb.VerboseTB._tb_highlight = "bg:ansired"
except Exception:
print("Error patching background color for tracebacks, they'll be the ugly default instead")
Verified to work with IPython version 8.7.0

How can I change background of the specific lines in Pygments?

I developed a code to show the coverage for specific C, C++ and Python files (Coverage is computed b using GCov). Now I can show the source code using Pygments. I have an array of covered lines and missed lines, I want to change the background of covered lines to green and background of missed lines to red. Is it possible to do that using Pygments?
You can achieve that by subclassing the HTMLFormatter. Out of the box the HTMLFormatter only supports line highlighting, but not in different colors as you need it. See https://pygments.org/docs/formatters/#HtmlFormatter for more details (scroll down to the subclassing part.)

How to use TextFlow

I am running netbeans 8.1 and scene builder 2.0 with javaFX 8.0. I have just started messing around with the TextFlow container recently. In my program, I have wrapped a textArea inside the TextFlow container, but I cannot figure out how to use my textflow to count the number of lines being displayed inside the text area. Some people recommend using "flowcomposer", but I do not seem to have the flow composer option for some reason, and I'm not really sure how to import it...
Text wrapping is set to "true" inside my textarea...unfortunately, this means I cannot programmatically count lines "as-is" by counting the number of newlines, since wrapped text does not include a newline character.
Ultimately, not only do I want to be able to get the number of lines being displayed, but I also want to get the current line or position my cursor at a specific line/scroll to a specific line.
What do you guys think? Is textflow and flowcomposer the way to do this, or am I barking up the wrong tree? If this is indeed a viable way to accomplish the goals stated above, why am I not being able to use textflow to get the lines?
Any help would be greatly appreciated!:)

Eclipse-RCP: Hide lines of text permanently, keep correct line numbers

I have text files which contain code inside an Editor. The user can run an analysis on a certain part of his code, which will result in a set of lines which should be hidden. Next I want to present the user with only the remaining lines, but with correct linenumbers, as from the original document. Possible solutions I thought of:
Open a new Editor which does not contain the hidden lines, but *somehow* still has correct line numbers
Hide the lines in the original editor, and offer a button for the user to 'unhide'. Probably a similar solution required as in 1.
I don't really know how to go about this. Folds would be a weird solution, because they can be unfolded individually, and seem to be more semantically tied to things like methods or classes. Also, simply creating a new document without the hidden lines results in wrong linenumbers.
Use a ProjectionViewer and reflection to invoke the private method ProjectionViewer.collapse(int offset int length). This method is only used internally to hide a certain portion of the text, by manipulating the ProjectionDocument (see http://eclipse.org/articles/Article-Folding-in-Eclipse-Text-Editors/folding.html).
After this, folding text in the editor using the annotations(the little +/- icons) WILL break everything, so this solution and regular folding are mutually exclusive.