Completed
Last Updated: 08 Oct 2021 10:15 by ADMIN
Release R3 2021 SP1
Steve
Created on: 15 Sep 2021 06:16
Category: SyntaxEditor
Type: Bug Report
0
RadSyntaxEditor: SQLTagger CURRENT_DATE and CURRENT_TIMESTAMP are not hightlighted
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 15 Sep 2021 06:18

Hello, Steve,

The possible solution that I can suggest is to create your own SQLTagger and control how the content is split into words:

    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        Dim currentLanguageTagger As CustomSqlTagger = New CustomSqlTagger(Me.RadSyntaxEditor1.SyntaxEditorElement)
        Me.RadSyntaxEditor1.TaggersRegistry.RegisterTagger(currentLanguageTagger)

    End Sub

    Public Class CustomSqlTagger
        Inherits Telerik.WinForms.Controls.SyntaxEditor.Taggers.SqlTagger

        Public Sub New(editor As RadSyntaxEditorElement)
            MyBase.New(editor)

        End Sub
        Protected Overrides Function SplitIntoWords(value As String) As IList(Of String)
            Dim words As List(Of String) = New List(Of String)()
            Dim word As String
            Dim lastCharType As Integer = -1
            Dim startIndex As Integer = 0

            For i As Integer = 0 To value.Length - 1
                Dim charType As Integer = GetCharType(value(i))

                If charType <> lastCharType Then
                    word = value.Substring(startIndex, i - startIndex)
                    words.Add(word)
                    startIndex = i
                    lastCharType = charType
                End If
            Next

            word = value.Substring(startIndex, value.Length - startIndex)
            words.Add(word)
            Return words
        End Function
        Friend Shared Function GetCharType(ByVal c As Char) As Integer
            If c = "#"c Then
                Return 0
            End If
            If c = "_"c Then
                Return 0
            End If

            If Char.IsWhiteSpace(c) Then
                Return 1
            End If

            If Char.IsPunctuation(c) OrElse Char.IsSymbol(c) Then
                Return 2
            End If

            Return 0
        End Function
    End Class

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.