Skip to content

Commit 3ded4c2

Browse files
authored
Merge pull request #22 from mattmc3/master
Add new keywords and funcs
2 parents 29b110e + 113c6f6 commit 3ded4c2

File tree

1 file changed

+74
-25
lines changed

1 file changed

+74
-25
lines changed

TSQL.tmLanguage

Lines changed: 74 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<string>sql</string>
88
<string>ddl</string>
99
<string>dml</string>
10+
<string>tsql</string>
1011
</array>
1112
<key>foldingStartMarker</key>
1213
<string>\s*\(\s*$</string>
@@ -223,13 +224,13 @@
223224
|\b(char|varchar\d?)\b(?:\((\d+)\))?
224225
225226
# special case, capture 6 + 7i + 8i
226-
|\b(numeric)\b(?:\((\d+),(\d+)\))?
227+
|\b(numeric|decimal)\b(?:\((\d+),(\d+)\))?
227228
228229
# special case, captures 9, 10i, 11
229-
|\b(times)(?:\((\d+)\))(\swithoutstimeszone\b)?
230+
|\b(times)(?:\((\d+)\))(\swith(?:out)?\stime\szone\b)?
230231
231232
# special case, captures 12, 13, 14i, 15
232-
|\b(timestamp)(?:(s)\((\d+)\)(\swithoutstimeszone\b)?)?
233+
|\b(timestamp)(?:(s)\((\d+)\)(\swith(?:out)?\stime\szone\b)?)?
233234
234235
</string>
235236
</dict>
@@ -283,17 +284,17 @@
283284
</dict>
284285
<dict>
285286
<key>comment</key>
286-
<string>Reserved keywords: https://msdn.microsoft.com/en-us/library/ms189822.aspx</string>
287+
<string>Reserved keywords: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql</string>
287288
<key>match</key>
288-
<string>(?i:\b(add|external|procedure|all|fetch|public|alter|file|raiserror|and|fillfactor|read|any|for|readtext|as|foreign|reconfigure|asc|freetext|references|authorization|freetexttable|replication|backup|from|restore|begin|full|restrict|between|function|return|break|goto|revert|browse|grant|revoke|bulk|group|right|by|having|rollback|cascade|holdlock|rowcount|case|identity|rowguidcol|check|identity_insert|rule|checkpoint|identitycol|save|close|if|schema|clustered|in|securityaudit|coalesce|index|select|collate|inner|semantickeyphrasetable|column|insert|semanticsimilaritydetailstable|commit|intersect|semanticsimilaritytable|compute|into|session_user|constraint|is|set|contains|join|setuser|containstable|key|shutdown|continue|kill|some|convert|left|statistics|create|like|system_user|cross|lineno|table|current|load|tablesample|current_date|merge|textsize|current_time|national|then|current_timestamp|nocheck|to|current_user|nonclustered|top|cursor|not|tran|database|null|transaction|dbcc|nullif|trigger|deallocate|of|truncate|declare|off|try_convert|default|offsets|tsequal|delete|on|union|deny|open|unique|desc|opendatasource|unpivot|disk|openquery|update|distinct|openrowset|updatetext|distributed|openxml|use|double|option|user|drop|or|values|dump|order|varying|else|outer|view|end|over|waitfor|errlvl|percent|when|escape|pivot|where|except|plan|while|exec|precision|with|execute|primary|within group|exists|print|writetext|exit|proc)\b)</string>
289+
<string>(?i:\b(add|external|procedure|all|fetch|public|alter|file|raiserror|and|fillfactor|read|any|for|readtext|as|foreign|reconfigure|asc|freetext|references|authorization|freetexttable|replication|backup|from|restore|begin|full|restrict|between|function|return|break|goto|revert|browse|grant|revoke|bulk|group|right|by|having|rollback|cascade|holdlock|rowcount|case|identity|rowguidcol|check|identity_insert|rule|checkpoint|identitycol|save|close|if|schema|clustered|in|securityaudit|coalesce|index|select|collate|inner|semantickeyphrasetable|column|insert|semanticsimilaritydetailstable|commit|intersect|semanticsimilaritytable|compute|into|session_user|constraint|is|set|contains|join|setuser|containstable|key|shutdown|continue|kill|some|convert|left|statistics|create|like|system_user|cross|lineno|table|current|load|tablesample|current_date|merge|textsize|current_time|national|then|current_timestamp|nocheck|to|current_user|nonclustered|top|cursor|not|tran|database|null|transaction|dbcc|nullif|trigger|deallocate|of|truncate|declare|off|try_convert|default|offsets|tsequal|delete|on|union|deny|open|unique|desc|opendatasource|unpivot|disk|openquery|update|distinct|openrowset|updatetext|distributed|openxml|use|double|option|user|drop|or|values|dump|order|varying|else|outer|view|end|over|waitfor|errlvl|percent|when|escape|pivot|where|except|plan|while|exec|precision|with|execute|primary|within\sgroup|exists|print|writetext|exit|proc)\b)</string>
289290
<key>name</key>
290291
<string>keyword.other.reserved.sql</string>
291292
</dict>
292293
<dict>
293294
<key>comment</key>
294-
<string>Control-of-flow keywords: https://msdn.microsoft.com/en-us//library/ms174290.aspx</string>
295+
<string>Control-of-flow keywords: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/control-of-flow</string>
295296
<key>match</key>
296-
<string>(?i:\b(BEGIN|END|RETURN|break|THROW|CONTINUE|TRY|CATCH|GOTO|WAITFOR|IF|ELSE|WHILE)\b)</string>
297+
<string>(?i:\b(begin|end|return|break|throw|continue|try|catch|goto|waitfor|if|else|while)\b)</string>
297298
<key>name</key>
298299
<string>keyword.other.reserved.sql</string>
299300
</dict>
@@ -367,123 +368,171 @@
367368
</dict>
368369
<dict>
369370
<key>comment</key>
370-
<string>Rowset functions: https://msdn.microsoft.com/en-us/library/ms187957.aspx</string>
371+
<string>Rowset functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/rowset-functions-transact-sql</string>
371372
<key>match</key>
372373
<string>(?i)\b(opendatasource|openrowset|openquery|openxml)\b</string>
373374
<key>name</key>
374375
<string>support.function.rowset.sql</string>
375376
</dict>
376377
<dict>
377378
<key>comment</key>
378-
<string>Aggregate Functions: https://msdn.microsoft.com/en-us/library/ms173454.aspx</string>
379+
<string>Aggregate Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/aggregate-functions-transact-sql</string>
379380
<key>match</key>
380381
<string>(?i)\b(avg|min|checksum_agg|sum|count|stdev|count_big|stdevp|grouping|var|grouping_id|varp|max)\b</string>
381382
<key>name</key>
382383
<string>support.function.aggr.sql</string>
383384
</dict>
384385
<dict>
385386
<key>comment</key>
386-
<string>Ranking Functions: https://msdn.microsoft.com/en-us/library/ms189798.aspx</string>
387+
<string>Ranking Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/ranking-functions-transact-sql</string>
387388
<key>match</key>
388389
<string>(?i)\b(rank|ntile|dense_rank|row_number)\b</string>
389390
<key>name</key>
390391
<string>support.function.ranking.sql</string>
391392
</dict>
392393
<dict>
393394
<key>comment</key>
394-
<string>Configuration Functions: https://msdn.microsoft.com/en-us/library/ms173823.aspx</string>
395+
<string>Analytic Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/analytic-functions-transact-sql</string>
396+
<key>match</key>
397+
<string>(?i)\b(cume_dist|lead|first_value|percentile_cont|lag|percentile_disc|last_value|percent_rank)\b</string>
398+
<key>name</key>
399+
<string>support.function.analytic.sql</string>
400+
</dict>
401+
<dict>
402+
<key>comment</key>
403+
<string>Collation Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/collation-functions-collationproperty-transact-sql</string>
404+
<key>match</key>
405+
<string>(?i)\b(collationproperty|tertiary_weights)\b</string>
406+
<key>name</key>
407+
<string>support.function.collation.sql</string>
408+
</dict>
409+
<dict>
410+
<key>comment</key>
411+
<string>Configuration Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/configuration-functions-transact-sql</string>
395412
<key>match</key>
396413
<string>(?i)@@\b(datefirst|options|dbts|remserver|langid|servername|language|servicename|lock_timeout|spid|max_connections|textsize|max_precision|version|nestlevel)\b</string>
397414
<key>name</key>
398415
<string>support.function.config.sql</string>
399416
</dict>
400417
<dict>
401418
<key>comment</key>
402-
<string>Conversion Functions: https://msdn.microsoft.com/en-us/library/hh231076.aspx</string>
419+
<string>Conversion Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/conversion-functions-transact-sql</string>
403420
<key>match</key>
404421
<string>(?i)\b(cast|convert|parse|try_cast|try_convert|try_parse)\b</string>
405422
<key>name</key>
406423
<string>support.function.rowset.sql</string>
407424
</dict>
408425
<dict>
409426
<key>comment</key>
410-
<string>Cursor Functions: https://msdn.microsoft.com/en-us/library/ms186285.aspx</string>
427+
<string>Cryptographic Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/cryptographic-functions-transact-sql</string>
428+
<key>match</key>
429+
<string>(?i)\b(encryptbykey|decryptbykey|encryptbypassphrase|decryptbypassphrase|key_id|key_guid|decryptbykeyautoasymkey|key_name|symkeyproperty|encryptbyasymkey|decryptbyasymkey|encryptbycert|decryptbycert|asymkeyproperty|asymkey_id|signbyasymkey|verifysignedbyasmkey|signbycert|verigysignedbycert|is_objectsigned|decryptbykeyautocert|hashbytes)\b</string>
430+
<key>name</key>
431+
<string>support.function.crypto.sql</string>
432+
</dict>
433+
<dict>
434+
<key>comment</key>
435+
<string>Cursor Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/cursor-functions-transact-sql</string>
411436
<key>match</key>
412437
<string>(?i)(@@\b(cursor_rows|fetch_status)|cursor_status)\b</string>
413438
<key>name</key>
414439
<string>support.function.cursor.sql</string>
415440
</dict>
416441
<dict>
417442
<key>comment</key>
418-
<string>Date and time Functions: https://msdn.microsoft.com/en-us/library/ms186724.aspx</string>
443+
<string>Data Type Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/data-type-functions-transact-sql</string>
419444
<key>match</key>
420-
<string>(?i)\b(sysdatetime|sysdatetimeoffset|sysutcdatetime|current_timestamp|getdate|getutcdate|datename|datepart|day|month|year|datefromparts|datetime2fromparts|datetimefromparts|datetimeoffsetfromparts|smalldatetimefromparts|timefromparts|datediff|dateadd|eomonth|switchoffset|todatetimeoffset|isdate)|@@\b(datefirst|language)\b</string>
445+
<string>(?i)(@@\b(datalength|ident_seed|ident_current|identity|ident_incr|sql_variant_property)\b</string>
446+
<key>name</key>
447+
<string>support.function.datatype.sql</string>
448+
</dict>
449+
<dict>
450+
<key>comment</key>
451+
<string>Date and time Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/date-and-time-data-types-and-functions-transact-sql</string>
452+
<key>match</key>
453+
<string>(?i)\b(sysdatetime|sysdatetimeoffset|sysutcdatetime|current_timestamp|getdate|getutcdate|datename|datepart|day|month|year|datefromparts|datetime2fromparts|datetimefromparts|datetimeoffsetfromparts|smalldatetimefromparts|timefromparts|datediff|datediff_big|dateadd|eomonth|switchoffset|todatetimeoffset|isdate)|@@\b(datefirst|language)\b</string>
421454
<key>name</key>
422455
<string>support.function.datetime.sql</string>
423456
</dict>
424457
<dict>
425458
<key>comment</key>
426-
<string>Logical Functions: https://msdn.microsoft.com/en-us/library/hh213226.aspx</string>
459+
<string>JSON Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/json-functions-transact-sql</string>
460+
<key>match</key>
461+
<string>(?i)\b(isjson|json_value|json_query|json_modify)\b</string>
462+
<key>name</key>
463+
<string>support.function.json.sql</string>
464+
</dict>
465+
<dict>
466+
<key>comment</key>
467+
<string>Logical Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/logical-functions-choose-transact-sql</string>
427468
<key>match</key>
428469
<string>(?i)\b(choose|iif)\b</string>
429470
<key>name</key>
430471
<string>support.function.logical.sql</string>
431472
</dict>
432473
<dict>
433474
<key>comment</key>
434-
<string>Mathematical Functions: https://msdn.microsoft.com/en-us/library/ms177516.aspx</string>
475+
<string>Mathematical Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/mathematical-functions-transact-sql</string>
435476
<key>match</key>
436477
<string>(?i)\b(abs|degrees|rand|acos|exp|round|asin|floor|sign|atan|log|sin|atn2|log10|sqrt|ceiling|pi|square|cos|power|tan|cot|radians)\b</string>
437478
<key>name</key>
438479
<string>support.function.math.sql</string>
439480
</dict>
440481
<dict>
441482
<key>comment</key>
442-
<string>Metadata Functions: https://msdn.microsoft.com/en-us/library/ms187812.aspx</string>
483+
<string>Metadata Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/metadata-functions-transact-sql</string>
443484
<key>match</key>
444485
<string>(?i)@@\b(procid)|\b(index_col|app_name|indexkey_property|applock_mode|indexproperty|applock_test|next value for|assemblyproperty|object_definition|col_length|object_id|col_name|object_name|columnproperty|object_schema_name|database_principal_id|objectproperty|databasepropertyex|objectpropertyex|db_id|original_db_name|db_name|parsename|file_id|schema_id|file_idex|schema_name|file_name|scope_identity|filegroup_id|serverproperty|filegroup_name|stats_date|filegroupproperty|type_id|fileproperty|type_name|fulltextcatalogproperty|typeproperty|fulltextserviceproperty)\b</string>
445486
<key>name</key>
446487
<string>support.function.metadata.sql</string>
447488
</dict>
448489
<dict>
449490
<key>comment</key>
450-
<string>Security Functions: https://msdn.microsoft.com/en-us/library/ms186236.aspx</string>
491+
<string>Replication Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/replication-functions-publishingservername</string>
492+
<key>match</key>
493+
<string>(?i)\b(publishingservername)\b</string>
494+
<key>name</key>
495+
<string>support.function.replication.sql</string>
496+
</dict>
497+
<dict>
498+
<key>comment</key>
499+
<string>Security Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/security-functions-transact-sql</string>
451500
<key>match</key>
452501
<string>(?i)\b(certencoded|pwdcompare|certprivatekey|pwdencrypt|current_user|schema_id|database_principal_id|schema_name|session_user|suser_id|suser_sid|has_perms_by_name|suser_sname|is_member|system_user|is_rolemember|suser_name|is_srvrolemember|user_id|original_login|user_name|permissions)\b</string>
453502
<key>name</key>
454503
<string>support.function.security.sql</string>
455504
</dict>
456505
<dict>
457506
<key>comment</key>
458-
<string>String Functions: https://msdn.microsoft.com/en-us/library/ms181984.aspx</string>
507+
<string>String Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/string-functions-transact-sql</string>
459508
<key>match</key>
460-
<string>(?i)\b(ascii|ltrim|soundex|char|nchar|space|charindex|patindex|str|concat|quotename|stuff|difference|replace|substring|format|replicate|unicode|left|reverse|upper|len|right|lower|rtrim)\b</string>
509+
<string>(?i)\b(ascii|char|charindex|concat|concat_ws|difference|format|left|len|lower|ltrim|nchar|patindex|quotename|replace|replicate|reverse|right|rtrim|soundex|space|str|string_agg|string_escape|string_split|stuff|substring|translate|trim|unicode|upper)\b</string>
461510
<key>name</key>
462511
<string>support.function.string.sql</string>
463512
</dict>
464513
<dict>
465514
<key>comment</key>
466-
<string>System Functions: https://msdn.microsoft.com/en-us/library/ms187786.aspx</string>
515+
<string>System Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/system-functions-transact-sql</string>
467516
<key>match</key>
468517
<string>(?i)\$\b(partition)|@@\b(error|identity|pack_received|rowcount|trancount)|\b(error_severity|error_state|formatmessage|getansinull|get_filestream_transaction_context|host_id|binary_checksum|host_name|checksum|isnull|connectionproperty|isnumeric|context_info|min_active_rowversion|current_request_id|newid|error_line|newsequentialid|error_message|rowcount_big|error_number|xact_state|error_procedure)\b</string>
469518
<key>name</key>
470519
<string>support.function.system.sql</string>
471520
</dict>
472521
<dict>
473522
<key>comment</key>
474-
<string>System Statistical Functions: https://msdn.microsoft.com/en-us/library/ms177520.aspx</string>
523+
<string>System Statistical Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/system-statistical-functions-transact-sql</string>
475524
<key>match</key>
476525
<string>(?i)@@\b(connections|pack_received|cpu_busy|pack_sent|timeticks|idle|total_errors|io_busy|total_read|packet_errors|total_write)\b</string>
477526
<key>name</key>
478527
<string>support.function.system-stats.sql</string>
479528
</dict>
480529
<dict>
481530
<key>comment</key>
482-
<string>Text and image Functions: https://msdn.microsoft.com/en-us/library/ms188353.aspx</string>
531+
<string>Text and image Functions: https://docs.microsoft.com/en-us/sql/t-sql/functions/text-and-image-functions-textptr-transact-sql</string>
483532
<key>match</key>
484533
<string>(?i)\b(patindex|textvalid|textptr)\b</string>
485534
<key>name</key>
486-
<string>support.function.text&amp;image.sql</string>
535+
<string>support.function.text-image.sql</string>
487536
</dict>
488537
<dict>
489538
<key>include</key>

0 commit comments

Comments
 (0)