Skip to main content
A newer version of this page is available. .

ISyntaxHighlightService.ForceExecute() Method

Reserved for future use.

Namespace: DevExpress.XtraRichEdit.Services

Assembly: DevExpress.RichEdit.v18.2.Core.dll

Declaration

void ForceExecute()

Remarks

The ForceExecute is introduced to support multi-threaded syntax highlighting in the future. Currently, you should implement this method by calling the ISyntaxHighlightService.Execute method.

Public Sub Execute() Implements ISyntaxHighlightService.Execute
    Dim newText As String = syntaxEditor.Text
    ' Determine language by file extension.
    Dim ext As String = System.IO.Path.GetExtension(syntaxEditor.Options.DocumentSaveOptions.CurrentFileName)
    Dim lang_ID As ParserLanguageID = ParserLanguage.FromFileExtension(ext)
    ' Do not parse HTML or XML.
    If lang_ID = ParserLanguageID.Html OrElse lang_ID = ParserLanguageID.Xml OrElse lang_ID = ParserLanguageID.None Then
        Return
    End If
    ' Use DevExpress.CodeParser to parse text into tokens.
    Dim tokenHelper As ITokenCategoryHelper = TokenCategoryHelperFactory.CreateHelper(lang_ID)
    Dim highlightTokens As TokenCollection
    highlightTokens = tokenHelper.GetTokens(newText)
    HighlightSyntax(highlightTokens)
End Sub

Public Sub ForceExecute() Implements  ISyntaxHighlightService.ForceExecute
    Execute()
End Sub
See Also