.. please write a brief description on what did you till now and what i can do (i tried reading last pages but it was not clear for me because i wasn't involved)
Sure. Here are what I knew:
* TSynHighligther (aka HL) knows the keywords. it does parsing to know the keywords. So, let it be only who doing parsing.
* TSynEditMarkup (and it's ancestors) is the only correct place of doing additional markup (additional color other than keywords).
* TSynMarkupWordGroup is the simplest markup to learn how HL & markup work together.
* HL shouldn't do drawing it self. never.
* HL provides several signals to be used to draw.
Such T***Attri for coloring the keyword,comment,symbol by specific colors. It's a legacy from old SynEdit (still founded in Github or Sourceforge).
and Lazarus's SynEdit provide additional signal via TNodeList.
* TNodeList can be called per-line basis, and can be called several time when needed by markup.
* TNOdeLIst contains several FoldNodeInfo, which each is generally for fold/unfold info (whether it is opening fold or closing one).
* Additionally, each FoldNodeInfo contains set of (
* sfaMarkup {used by TMarkupWordGroup},
* sfaOpen,sfaClose {used by TMarkupWordGroup to connect/find paired keyword such begin..end, try/finally/end, procedure/begin/end etc}
* sfaFold {used by FoldGUtter and CodeBUffer to collapse/expand a block of code, together with sfaOpen&sfaClose}
* sfaHide {for comments, it is similar as sfaFold, but will collapse to previous line while sfaFold collapse to first-block-line}
* sfaOutline {it is new, for our colorizing. If any nodeInfo contains "sfaOutline", I got it. If it doesn't contain "sfaOutline" I ignore it}
FoldNodeInfo is generated by HL, but it depends on Markup class existence to draw.
Well, neither Markup do drawing by itself. Each markup also only provides some instruction of drawing to be done by TSynEdit.
The real drawer is not Markup nor HL. It is because even small individual drawing will cost of time.
Managed drawing will reduce time. Believe it!
Here is a simple diagram of their connectivity:
Form1
> SynEdit1
> SynMarkupManager1
> SynMarkupWordGroup1
> SynMarkupColororing1
> SynFreePascalSyn1
some markups has been created automatically inside SynEdit. So, you must add SynMarkupColoring1 manually.
So, what was I really doing?
* The root class of all foldable HL (TSynFoldHighlighterBase) now provide simple sfaOutline for every foldable node.
But it later depends on ancestor of whether it should foldable or not (and has outline or not) by setting SupportedMode & Mode properties.
* TSynPasSyn (and TSynFreePascalSyn) still never draw any markup by itself.
It just provide those FoldNodeInfoList which in turn will be used to draw by any markup.
* my TSynMarkupColoring class, for each line, will call HL.NodeInfo[ y ];
In fact, for each line, TSynMarkupColoring will call that too many time as needed, because I need to get all parent.
See? The latest problem which not yet being solved is: it always search all parents, even those parents has been founded for previous line.
Why it is hard? Because it involves some classes, It is not written in a simple function to do that. I need to learn more deeply to achieve that. (and more time)
Don't worry, there is a way for quick jump/ to get be fast involved:
1. search the call of "StartCodeFoldBlock" and "EndCodeFoldBlock" for any foldable HL.
(In TSynPasSyn, these are wrapped in method "StartPascalCodeFoldBlock" and "EndPascalCodeFoldBlock", with different parameter)
Both methods is a chance to provide signals (sfaOpen, sfaFold, sfaHide, sfaOutline, etc.).
So you
can detect when it is called by search in whole file (Ctrl+Shift+F).
2. The real nodefoldinfo's generator is method: "DoInitNode". this method is called by above "StartCodeFoldBlock" and "EndCodeFoldBlock".
TSynPasSyn has it's own DoInitNode, because it has 3 group: Neutral/Pascal folding group, {$IFDEF folding group, {%region folding group.
Any other HL seem don't need to override this method.
I highly recomended to learn how TMarkupWordGroup works.
Then you can learn something else, but avoid to learn TPasSynPas too early, because it complexity may confusing you of learning the essential things.
greeting.