How can I get a SyntaxLanguage's HighlightStyleRegistry?

SyntaxEditor for WPF Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0541
Avatar
Reading through the SyntaxEditor documentation, it seems that when using SyntaxLanguageDefinitionSerializer to load a language, it's also possible to obtain that language's style registry. How can I obtain a language's HighlightStyleRegistry if I already have the language object? For example, if I'm using the XmlLanguage in the Web Add-On?

Thanks,

-Craig

[Modified at 03/03/2011 01:25 PM]

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Craig,

In your SyntaxLanguageDefinitionSerializer instance, you can set a HighlightingStyleRegistry property before you deserialize the language. In that case, the highlighting styles will be loaded into that instead of the ambient one. So you could possibly look at them that way. But you'd have to have the .langdef available for that.

Other than that, it's up to the language to provide the classification types if it wants. Like the XML language has a XmlClassificationTypeProvider class you can create to get instances of the classification types and then hit the ambient style registry to get the related styles.


Actipro Software Support

Posted 13 years ago by Craig - Varigence, Inc.
Avatar
So, what if I'm using the CSharp language from the .NET add-ons? There doesn't seem to be a CSharpClassificationTypeProvider object.

Should I assume that once I assign a language to syntaxEditor.Document.Language, that the syntaxEditor's HighlightingStyleRegistry object will return the language's HighlightingStyleRegistry, if it has one, or otherwise return null. If that's not the case (and since I'm using languages that are already created in the add-ons, so I won't be using the SyntaxLanguageDefinitionSerializer), how can I access a language's HighlightingStyleRegistry?

Thanks again,

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

The .NET add-on's one is ActiproSoftware.Text.Languages.DotNet.Implementation.DotNetClassificationTypeProvider (used for both C#/VB).

SyntaxEditor.HighlightingStyleRegistry is only if you want to force the SyntaxEditor to use a custom IHighlightingStyleRegistry. If that is null, it will use the AmbientHighlightingStyleRegistry. There is no way to know what styles were created for a language other than if the language has a classification type provider.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.