Common/SQLEditor: Don't highlight comments
This commit is contained in:
parent
03c3f2be3b
commit
26e31a1095
@ -1,13 +1,14 @@
|
||||
DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraRichEdit.RichEditControl, DevExpress.XtraRichEdit.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.ProgressBarControl, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.Repository.RepositoryItemDateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@ -15,7 +15,7 @@ Namespace SQLEditor
|
||||
|
||||
Private _keywords As Regex
|
||||
Private _quotedString As New Regex("'([^']|'')*'")
|
||||
Private _commentedString As New Regex("(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)")
|
||||
Private _commentedString As New Regex("(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)")
|
||||
Private _placeholderString As New Regex("{#(\w+)#([\:\.\w\s_/-]+)}")
|
||||
|
||||
Private ReadOnly keywords As New List(Of String) From {
|
||||
@ -35,12 +35,14 @@ Namespace SQLEditor
|
||||
"GO",
|
||||
"DECLARE",
|
||||
"EXECUTE",
|
||||
"NVARCHAR",
|
||||
"FROM",
|
||||
"INTO",
|
||||
"VALUES",
|
||||
"WHERE",
|
||||
"AND"
|
||||
"AND",
|
||||
"INNER",
|
||||
"AS",
|
||||
"IN"
|
||||
}
|
||||
|
||||
Public Sub New(ByVal document As Document)
|
||||
@ -60,6 +62,15 @@ Namespace SQLEditor
|
||||
Dim oTokens As New List(Of SyntaxHighlightToken)()
|
||||
Dim oRanges As IEnumerable(Of DocumentRange) = Nothing
|
||||
|
||||
' This is deactivated for now because it times out finding big comment in a sql
|
||||
'Find all comments
|
||||
'oRanges = TryCast(document.FindAll(_commentedString).GetAsFrozen(), DocumentRange())
|
||||
'For Each oRange In oRanges
|
||||
' If Not IsRangeInTokens(oRange, oTokens) Then
|
||||
' oTokens.Add(CreateToken(oRange.Start.ToInt(), oRange.End.ToInt(), Color.Green))
|
||||
' End If
|
||||
'Next
|
||||
|
||||
' search for quoted strings
|
||||
oRanges = document.FindAll(_quotedString).GetAsFrozen()
|
||||
For Each oRange In oRanges
|
||||
@ -82,14 +93,6 @@ Namespace SQLEditor
|
||||
End If
|
||||
Next
|
||||
|
||||
'Find all comments
|
||||
oRanges = TryCast(document.FindAll(_commentedString).GetAsFrozen(), DocumentRange())
|
||||
For Each oRange In oRanges
|
||||
If Not IsRangeInTokens(oRange, oTokens) Then
|
||||
oTokens.Add(CreateToken(oRange.Start.ToInt(), oRange.End.ToInt(), Color.Green))
|
||||
End If
|
||||
Next
|
||||
|
||||
' order tokens by their start position
|
||||
oTokens.Sort(New SyntaxHighlightTokenComparer())
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ Public Class frmSQLEditor
|
||||
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
FormLoading = True
|
||||
txtSQLCommand.BeginUpdate()
|
||||
|
||||
Try
|
||||
If PlaceholdersAutomatic Is Nothing Then
|
||||
PlaceholdersAutomatic = New Dictionary(Of String, String)
|
||||
@ -86,6 +88,7 @@ Public Class frmSQLEditor
|
||||
chkClearPlaceholders.Checked = ClearPlaceholdersAfterSuccessfulExecute
|
||||
Catch ex As Exception
|
||||
Finally
|
||||
txtSQLCommand.EndUpdate()
|
||||
FormLoading = False
|
||||
End Try
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user