Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CodeMirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Aurel Pascal Schubotz
CodeMirror
Commits
e9c52f3d
Commit
e9c52f3d
authored
6 years ago
by
Tugrul Elmas
Committed by
Marijn Haverbeke
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[sql mode] Add text/x-mssql dialect and ssms theme
parent
e8fa9720
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mode/sql/sql.js
+18
-9
18 additions, 9 deletions
mode/sql/sql.js
theme/ssms.css
+16
-0
16 additions, 0 deletions
theme/ssms.css
with
34 additions
and
9 deletions
mode/sql/sql.js
+
18
−
9
View file @
e9c52f3d
...
@@ -22,7 +22,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
...
@@ -22,7 +22,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
support
=
parserConfig
.
support
||
{},
support
=
parserConfig
.
support
||
{},
hooks
=
parserConfig
.
hooks
||
{},
hooks
=
parserConfig
.
hooks
||
{},
dateSQL
=
parserConfig
.
dateSQL
||
{
"
date
"
:
true
,
"
time
"
:
true
,
"
timestamp
"
:
true
},
dateSQL
=
parserConfig
.
dateSQL
||
{
"
date
"
:
true
,
"
time
"
:
true
,
"
timestamp
"
:
true
},
backslashStringEscapes
=
parserConfig
.
backslashStringEscapes
!==
false
backslashStringEscapes
=
parserConfig
.
backslashStringEscapes
!==
false
,
brackets
=
parserConfig
.
brackets
||
/^
[\{
}
\(\)\[\]]
/
,
punctuation
=
parserConfig
.
punctuation
||
/^
[
;.,:
]
/
function
tokenBase
(
stream
,
state
)
{
function
tokenBase
(
stream
,
state
)
{
var
ch
=
stream
.
next
();
var
ch
=
stream
.
next
();
...
@@ -65,9 +67,6 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
...
@@ -65,9 +67,6 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
// charset casting: _utf8'str', N'str', n'str'
// charset casting: _utf8'str', N'str', n'str'
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
return
"
keyword
"
;
return
"
keyword
"
;
}
else
if
(
/^
[\(\)
,
\;\[\]]
/
.
test
(
ch
))
{
// no highlighting
return
null
;
}
else
if
(
support
.
commentSlashSlash
&&
ch
==
"
/
"
&&
stream
.
eat
(
"
/
"
))
{
}
else
if
(
support
.
commentSlashSlash
&&
ch
==
"
/
"
&&
stream
.
eat
(
"
/
"
))
{
// 1-line comment
// 1-line comment
stream
.
skipToEnd
();
stream
.
skipToEnd
();
...
@@ -96,7 +95,15 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
...
@@ -96,7 +95,15 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
}
else
if
(
operatorChars
.
test
(
ch
))
{
}
else
if
(
operatorChars
.
test
(
ch
))
{
// operators
// operators
stream
.
eatWhile
(
operatorChars
);
stream
.
eatWhile
(
operatorChars
);
return
null
;
return
"
operator
"
;
}
else
if
(
brackets
.
test
(
ch
))
{
// brackets
stream
.
eatWhile
(
brackets
);
return
"
bracket
"
;
}
else
if
(
punctuation
.
test
(
ch
))
{
// punctuation
stream
.
eatWhile
(
punctuation
);
return
"
punctuation
"
;
}
else
if
(
ch
==
'
{
'
&&
}
else
if
(
ch
==
'
{
'
&&
(
stream
.
match
(
/^
(
)
*
(
d|D|t|T|ts|TS
)(
)
*'
[^
'
]
*'
(
)
*}/
)
||
stream
.
match
(
/^
(
)
*
(
d|D|t|T|ts|TS
)(
)
*"
[^
"
]
*"
(
)
*}/
)))
{
(
stream
.
match
(
/^
(
)
*
(
d|D|t|T|ts|TS
)(
)
*'
[^
'
]
*'
(
)
*}/
)
||
stream
.
match
(
/^
(
)
*
(
d|D|t|T|ts|TS
)(
)
*"
[^
"
]
*"
(
)
*}/
)))
{
// dates (weird ODBC syntax)
// dates (weird ODBC syntax)
...
@@ -289,11 +296,13 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
...
@@ -289,11 +296,13 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
CodeMirror
.
defineMIME
(
"
text/x-mssql
"
,
{
CodeMirror
.
defineMIME
(
"
text/x-mssql
"
,
{
name
:
"
sql
"
,
name
:
"
sql
"
,
client
:
set
(
"
charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee
"
),
client
:
set
(
"
$partition binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id
"
),
keywords
:
set
(
sqlKeywords
+
"
begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec
"
),
keywords
:
set
(
sqlKeywords
+
"
begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec
go if use index holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx updlock with
"
),
builtin
:
set
(
"
bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table
"
),
builtin
:
set
(
"
bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table
"
),
atoms
:
set
(
"
false true null unknown
"
),
atoms
:
set
(
"
is not null like and or in left right between inner outer join all any some cross unpivot pivot exists
"
),
operatorChars
:
/^
[
*+
\-
%<>!=
]
/
,
operatorChars
:
/^
[
*+
\-
%<>!=^
\&
|
\/]
/
,
brackets
:
/^
[\{
}
\(\)]
/
,
punctuation
:
/^
[
;.,:
/]
/
,
backslashStringEscapes
:
false
,
backslashStringEscapes
:
false
,
dateSQL
:
set
(
"
date datetimeoffset datetime2 smalldatetime datetime time
"
),
dateSQL
:
set
(
"
date datetimeoffset datetime2 smalldatetime datetime time
"
),
hooks
:
{
hooks
:
{
...
...
This diff is collapsed.
Click to expand it.
theme/ssms.css
0 → 100644
+
16
−
0
View file @
e9c52f3d
.cm-s-ssms
span
.cm-keyword
{
color
:
blue
;
}
.cm-s-ssms
span
.cm-comment
{
color
:
darkgreen
;
}
.cm-s-ssms
span
.cm-string
{
color
:
red
;
}
.cm-s-ssms
span
.cm-def
{
color
:
black
;
}
.cm-s-ssms
span
.cm-variable
{
color
:
black
;
}
.cm-s-ssms
span
.cm-variable-2
{
color
:
black
;
}
.cm-s-ssms
span
.cm-atom
{
color
:
darkgray
;
}
.cm-s-ssms
.CodeMirror-linenumber
{
color
:
teal
;
}
.cm-s-ssms
.CodeMirror-activeline-background
{
background
:
#ffffff
;
}
.cm-s-ssms
span
.cm-string-2
{
color
:
#FF00FF
;
}
.cm-s-ssms
span
.cm-operator
,
.cm-s-ssms
span
.cm-bracket
,
.cm-s-ssms
span
.cm-punctuation
{
color
:
darkgray
;
}
.cm-s-ssms
.CodeMirror-gutters
{
border-right
:
3px
solid
#ffee62
;
background-color
:
#ffffff
;
}
.cm-s-ssms
div
.CodeMirror-selected
{
background
:
#ADD6FF
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment