New to Telerik UI for WinFormsStart a free 30-day trial

Definition

Namespace:Telerik.WinForms.Documents.Model.Code

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class CodeFormatter

Inheritance: objectCodeFormatter

Constructors

C#
public CodeFormatter()

Methods

Gets all registered the code languages.

C#
public IEnumerable<CodeLanguage> GetCodeLanguages()
Returns:

IEnumerable<CodeLanguage>

Creates fragment containing formatted code block.

C#
public DocumentFragment GetFormattedFragment(string code, CodeFormattingSettings settings)
Parameters:codestring

The code.

settingsCodeFormattingSettings

The settings.

Returns:

DocumentFragment

DocumentFragments with formatted code block

Registers classification type for a specific code language and its corresponding style.

C#
public void RegisterClassificationType(ClassificationType type, CodeLanguage codeLanguage, StyleDefinition styleDefinition)
Parameters:typeClassificationType

The type.

codeLanguageCodeLanguage

The code language.

styleDefinitionStyleDefinition

The style definition.

Registers classification type and its corresponding style.

C#
public void RegisterClassificationType(ClassificationType type, StyleDefinition styleDefinition)
Parameters:typeClassificationType

The classification type.

styleDefinitionStyleDefinition

The style definition.

Registers a code language and its corresponding tagger.

C#
public void RegisterCodeLanguage(CodeLanguage codeLanguage, ITagger<ClassificationTag> tagger)
Parameters:codeLanguageCodeLanguage

The code language.

taggerITagger<ClassificationTag>

The tagger.

Unregisters classification type for a specific code language and its corresponding style.

C#
public void UnregisterClassificationType(ClassificationType type, CodeLanguage codeLanguage)
Parameters:typeClassificationType

The type.

codeLanguageCodeLanguage

The code language.

Unregisters classification type and its corresponding style.

C#
public void UnregisterClassificationType(ClassificationType type)
Parameters:typeClassificationType

The classification type.

Unregisters a code language and its corresponding tagger.

C#
public void UnregisterCodeLanguage(CodeLanguage codeLanguage)
Parameters:codeLanguageCodeLanguage

The code language.