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.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.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.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.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.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.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.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.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 _keywords As Regex
|
||||||
Private _quotedString As New 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 _placeholderString As New Regex("{#(\w+)#([\:\.\w\s_/-]+)}")
|
||||||
|
|
||||||
Private ReadOnly keywords As New List(Of String) From {
|
Private ReadOnly keywords As New List(Of String) From {
|
||||||
@ -35,12 +35,14 @@ Namespace SQLEditor
|
|||||||
"GO",
|
"GO",
|
||||||
"DECLARE",
|
"DECLARE",
|
||||||
"EXECUTE",
|
"EXECUTE",
|
||||||
"NVARCHAR",
|
|
||||||
"FROM",
|
"FROM",
|
||||||
"INTO",
|
"INTO",
|
||||||
"VALUES",
|
"VALUES",
|
||||||
"WHERE",
|
"WHERE",
|
||||||
"AND"
|
"AND",
|
||||||
|
"INNER",
|
||||||
|
"AS",
|
||||||
|
"IN"
|
||||||
}
|
}
|
||||||
|
|
||||||
Public Sub New(ByVal document As Document)
|
Public Sub New(ByVal document As Document)
|
||||||
@ -60,6 +62,15 @@ Namespace SQLEditor
|
|||||||
Dim oTokens As New List(Of SyntaxHighlightToken)()
|
Dim oTokens As New List(Of SyntaxHighlightToken)()
|
||||||
Dim oRanges As IEnumerable(Of DocumentRange) = Nothing
|
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
|
' search for quoted strings
|
||||||
oRanges = document.FindAll(_quotedString).GetAsFrozen()
|
oRanges = document.FindAll(_quotedString).GetAsFrozen()
|
||||||
For Each oRange In oRanges
|
For Each oRange In oRanges
|
||||||
@ -82,14 +93,6 @@ Namespace SQLEditor
|
|||||||
End If
|
End If
|
||||||
Next
|
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
|
' order tokens by their start position
|
||||||
oTokens.Sort(New SyntaxHighlightTokenComparer())
|
oTokens.Sort(New SyntaxHighlightTokenComparer())
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,8 @@ Public Class frmSQLEditor
|
|||||||
|
|
||||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
FormLoading = True
|
FormLoading = True
|
||||||
|
txtSQLCommand.BeginUpdate()
|
||||||
|
|
||||||
Try
|
Try
|
||||||
If PlaceholdersAutomatic Is Nothing Then
|
If PlaceholdersAutomatic Is Nothing Then
|
||||||
PlaceholdersAutomatic = New Dictionary(Of String, String)
|
PlaceholdersAutomatic = New Dictionary(Of String, String)
|
||||||
@ -86,6 +88,7 @@ Public Class frmSQLEditor
|
|||||||
chkClearPlaceholders.Checked = ClearPlaceholdersAfterSuccessfulExecute
|
chkClearPlaceholders.Checked = ClearPlaceholdersAfterSuccessfulExecute
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Finally
|
Finally
|
||||||
|
txtSQLCommand.EndUpdate()
|
||||||
FormLoading = False
|
FormLoading = False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user