Is it possible to color C# class/interface names in the SyntaxEditor?

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 2 years ago by Chris Shaw
Version: 17.1.0652
Avatar

The tooltips in Intellisense already do this, as do the hover-over info tooltips (I'd show you if I could add an image to this comment...).

var x = 3 * 2;
var list = new List<int>();
list.Add(x);

 If you hover over Add (or over the constructor), the word 'List' is colored differently within the tooltip -- can I also color it in the actual SyntaxEditor?

Also, is there a way to change the default colors for the Classifications that do exist (ie: String, Number, etc.)?  Is there a sample project that would have shown me (if only I'd looked more closely)?

 

Thanks,

Chris

Comments (3)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

Sorry but we don't currently have logic in there to determine which identifiers are type names (compared to namespace names, other identifiers, etc.).  That would require us to run the resolver on every single identifier constantly as typing occurs, which unless done asynchronously, would be too impactful on performance.  

As for changing colors, yes we have a Highlighting Style viewer QuickStart on that in the sample project under:  "SampleBrowser\ProductSamples\SyntaxEditorSamples\QuickStart\HighlightingStyleViewer".  But we just noticed that due to a recent update in how BrushEditBox works (used in that sample's HighlightingStyleEditor.xaml file in three places), it was forcing the default brushes to be Red since null's weren't being allowed.  Before you launch that sample, please add IsNullAllowed="True" to each of the three BrushEditBox instances in that file so that it works as intended.  We are making that fix for the next version.

There is also documentation on highlighting styles and highlighting style registries that tells you how to update styles.


Actipro Software Support

Posted 2 years ago by Chris Shaw
Avatar

But you *do* have that logic in your tooltips, which update "constantly as typing occurs".  That doesn't seem like it has too much of a performance hit?

In any case, the highlighting styles and samples should keep me busy for a while.

Thanks,

--Chris

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

The tooltips use a different set of logic and much easier logic at that.  In that case, we already have all the ITypeDefinition info available to us without having to do much resolution at all.

When you want to do syntax highlighting of type names in the editor itself, each offset has different contexts and thus resolver results since new identifiers could be declared on the line above, etc.  Doing resolution of identifiers is what adds up to be time consuming.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.