Closed CetoBasilius closed 6 years ago
This should be possible, but is likely to require couple of new API calls to be added, so I'll take a look after the next release is out.
Sounds good. It occurred to me that maybe i could rewire the output console to use a spec file (If it does not already). I see the local/remote console already uses this method:
Maybe just adding a new spec file to recognize [E], [W], [D], [I] as keywords and color them? will experiment and see what i can make of it.
EDIT:
Adding a spec file to the console works! after running SetupKeywords(ide.frame.bottomnotebook.errorlog,"lua",nil,ide.config.stylesoutshell,ide.font.oNormal,ide.font.oItalic)
on the local console i get this on my output window:
Maybe i can somehow add it to my configuration file, will make my log spec file and come back with results!
EDIT2: I just can't seem to get it to work. I can get the letters colored if i add them as keywords, but not the colors i want to assign to them, Also could not get the [] to get colored. I guess the outputfilter way would be way easier for users who are not too familiar with zerobranes source code. Will keep trying though.
@CetoBasilius, the colors are controlled by keywords0, keywords1, etc. settings (assigned as stylesoutshell.keywords0.fg = {255, 0, 0}
for example). You can modify the values using something like (not that the color of keywords[1] is unfortunately controlled by keywords0 and so on as the numbers in keywords0 constants are 0-based):
local luaspec = ide.specs.lua
luaspec.keywords[1] = luaspec.keywords[1] .. ' Main Database Localization'
I think coloring of square brackets is problematic as it's controlled by the lexer. Things should get easier when I finish integrating LexLPeg as it will allow you to add your own lexer written in Lua, so you can parse and color editor/Output/Console content almost any way you want.
That sounds great. Had no luck with the spec file approach. Explored ZBS all the way around though, very good project.
I've been making progress with the LexLPeg lexer, so it's likely to be included in the next release.
Are there any news related to this issue? I saw that release 1.5 has something new related to LexLPeg.
@pedro-andrade-inpe, yes, there have been further improvements to LexLPeg, which should not be working on all supported platforms (OSX support was included in 1.60 and Linux will be included in 1.70), but there haven't been any new work done on this issue.
What would you be specifically interested in? Do you need some arbitrary color (like, "output this line and color it red"), or do you need colors according to some format (like, "the output follows this format, which has elements with specific colors")?
I need to have colored output in the same way of Linux/Mac terminal. For example:
In ZeroBrane I got:
If the code in the description of the issue (debugger.outputfilter = ...
) works, I could try to write a package for ZBS.
@pedro-andrade-inpe, it should be possible using the ErrorList lexer as it supports escape sequences, but I can't get it to work. I posted a message to the Scintilla maillist and will update when I hear back.
Very nice! Looking forward to use this functionality! Thanks!
@pedro-andrade-inpe, @CetoBasilius, I've implemented support for ansi-color escapes in the Output panel, so you can color the output using those escapes. It's enabled by default, but can be turned off with output.showansi=false
setting.
For example, the following script should print all supported colors in the Output panel when executed from the IDE:
for i = 0,8 do
print(("%s \027[%dmXYZ\027[0m normal"):format(30+i, 30+i))
end
for i = 0,8 do
print(("%s \027[1;%dmXYZ\027[0m bright"):format(38+i, 30+i))
end
We have an internal logging system which adds an identifier to messages depending on how they call the library.
logger.info adds an [I] logger.warn adds a [W] logger.error adds a [E] logger.debug adds a [D]
Here is a screenshot:
Would like to be able to color specific lines depending on what some sort of parser finds, for example, in the outputfilter this could be done by finding the desired pattern and return or set the next line text color.
Something like that. could it be possible? or any other way?
Here is an example for a quick google search for "colored output console" (Not the prettiest)
Maybe just color the "[E]" via a spec file for the console? That's another idea.