Recent

Author Topic: User defined markup — coloring all words with a specific prefix  (Read 3177 times)

furious programming

  • Hero Member
  • *****
  • Posts: 864
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?
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10232
  • Debugger - SynEdit - and more
    • wiki
Re: User defined markup — coloring all words with a specific prefix
« Reply #1 on: July 29, 2023, 01:12:55 pm »
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").

furious programming

  • Hero Member
  • *****
  • Posts: 864
Re: User defined markup — coloring all words with a specific prefix
« Reply #2 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?

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.
« Last Edit: July 29, 2023, 01:38:25 pm by furious programming »
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10232
  • Debugger - SynEdit - and more
    • wiki
Re: User defined markup — coloring all words with a specific prefix
« Reply #3 on: July 29, 2023, 04:55:16 pm »
Meh, it's a pity... Is there a chance that such a possibility will be added to the new Lazarus release?

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).
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.
Yep...

I am not against the feature.

Happy to guide you, if you want to try.

 

TinyPortal © 2005-2018