Style of the CollapsedText

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Paul Fuller
Version: 4.0.0258
Avatar
There is SyntaxEditorRenderer.OutliningIndicatorBackColor/ForeColor. These affect the outlining indicators as you would expect.

Is there any way to set the style of the node CollapsedText ? (not the hover text but the collapsed region as shown in the editor)

Note that VS2005 uses the same colour for the indicator and the CollapsedText including the border. This would be Ok, however full control over the FontFamilyName, FontSize, ForeColor, BackColor and Border would be great to have.

Comments (5)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Paul,

Yes if you define a style in your root language named CollapsibleTextStyle, it will control this text style. The dynamic C# language sample shows an example of it.


Actipro Software Support

Posted 12 years ago by Paul Fuller
Avatar
I'm working on a non-dynamic langauge and have not been able to find an equivalent setting.

Is there one and where do I find it ?

Also, there can be different types of collapsible nodes such as statements, block comments and regions. What do you think of an enhancement to allow the style to be specified per OutliningNode ?

There could be a property such as CollapsibleTextStyle. If it is null then the default (as above) is used. This would only be a reference to a HighlightingStyle and you would probably just use the same style as for the expanded text.

Thoughts ?
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Paul,

All languages use highlighting styles so the same thing applies for non-dynamic languages. If you have a style with that name in the SyntaxLanguage.HighlightingStyles collection, it should be getting picked up.

As for node-based styles, I'm not sure if that would work. The reason is that the lexical parsing phase (which governs the highlighting) occurs before the outlining nodes are built. And there might be other scenarios where the outlining node tree is being reparsed and wouldn't be able to provide the proper info, etc.


Actipro Software Support

Posted 12 years ago by Paul Fuller
Avatar
Adding the HiglightingStyle as you suggested works.
            this.HighlightingStyles.Add(new HighlightingStyle("CollapsibleTextStyle", "Collapsible Text", Color.DeepPink, Color.WhiteSmoke));
So that is resolved. Thanks.

This is the only style that I add to the SyntaxLanguage.HighlightingStyles. All of the others are returned by SyntaxLanguage.GetHighlightingStyle override based on the token parameter. I keep my own collection of styles which is to do with how they are persisted and how they can be edited in my options dialog. Also the style for a token can vary based on context so a programmatic approach worked best for me.

I'm not sure if I conveyed my suggestion on collapsible node level styles properly. It doesn't have anything really to do with the tokens that are represented by the collapsed node other than of course that it is in examining the tokens that the AST node that is collapsible has been identified and created.

What I'm referring to is when the AST node is collapsed and needs to be rendered. You are accessing it to get the CollapsedText which is what will be displayed. At the same point could it not access a CollapsedTextStyle property to know how it should be rendered ?

As usual you would give it a virtual implementation to just return null and therefore not require an actual data member. A value of null causes the existing behaviour whereby all collapsed nodes are rendered in the same style. Override it and give a non-null value for those AST nodes that you want rendered differently.

Just a suggestion.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It's an interesting suggestion, we'll write it down. Thanks Paul!


Actipro Software Support

The latest build of this product (v2018.1 build 0342) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.