Forum > Options
User defined markup — coloring all words with a specific prefix
(1/1)
flowCRANE:
Suppose I have different identifiers in the project, but each of them has a specific prefix, for example SDL_.
Is it possible to configure markup to color all words (whole words) with such a prefix? For example, we have SDL_SetWindowSize and SDL_RenderCopy and they would be colored as a whole, in a certain way. The prefix is important, and if it's at the beginning of a word, the whole word is colored — no matter what comes after the prefix or how long the word is. Is it possible?
Martin_fr:
Unfortunately not.
I haven't looked at the sources, how complex it would be to change them.
For prefix, it should be possible to implement, because once you found it, it just needs to continue to the end of word.
If you want to do it, it needs an option (checkbox) to enable (similar like current "match word bound").
flowCRANE:
Meh, it's a pity... Is there a chance that such a possibility will be added to the new Lazarus release?
We used to talk about whether it would be possible to add more elements for coloring, including for variables or function calls, but since the highlighter is too limited, it doesn't seem possible to implement it (except for identifiers after the dot operator). If added support for coloring whole words based on prefixes, I could colorize a bit more, which would make it easier for me to analyze the code (the more elements able to colorize, the better for me).
In addition, by respecting prefixes/postfixes, it would also be possible, for example, to color identifiers after the dot operator (using the prefix ".", i.e. only a dot), as well as function calls (using the postfix "(", and the earlier part doesn't matter). So it would be possible not only to color identifiers with a common prefix/postfix, but also to manipulate the color of these identifiers for specific cases of their use (field, function call, etc.). And to extend the possibilities even further, support for the mask character (that is, "*") could be added, so that the prefix and postfix can be used at the same time, regardless of the middle part of the identifier content.
So, as you can see, one added function (prefix/postfix support), and a lot of possibilities for its use.
Martin_fr:
--- Quote from: furious programming on July 29, 2023, 01:25:33 pm ---Meh, it's a pity... Is there a chance that such a possibility will be added to the new Lazarus release?
--- End quote ---
3.0 is feature complete (as it has been branched).
Otherwise, I like the idea (in fact had it before) => but I got a lot of other stuff, that is currently higher on my prior list.
--- Quote ---We used to talk about whether it would be possible to add more elements for coloring, including for variables or function calls, but since the highlighter is too limited, it doesn't seem possible to implement it (except for identifiers after the dot operator). If added support for coloring whole words based on prefixes, I could colorize a bit more, which would make it easier for me to analyze the code (the more elements able to colorize, the better for me).
--- End quote ---
In fact, this is one of the things higher on my list; the colorizing for types, method ,...
It is not highlighter though, it is markup.
--- Quote ---So, as you can see, one added function (prefix/postfix support), and a lot of possibilities for its use.
--- End quote ---
Yep...
I am not against the feature.
Happy to guide you, if you want to try.
Navigation
[0] Message Index