I just upgraded to Build 4200 and the changelog says “Rewritten syntax highlighting for SQL”. How can I revert to the old SQL syntax highlighting? If I cannot, then I would like to post how I prefer the old one. With the old, two dashes made a comment. With the new, two dashes followed by a space makes a comment. But two dashes followed by any other text is not a comment. Also, several key words like select, from, where are no longer highlighted in this example of a sql that I use regularly.
Build 4200-Rewritten syntax highlighting for SQL Is Bad
duplicate of SQL syntax highlighting doesn't recognize double dash with no space after it as comments
iIt’s also problematic when using SELECT * FROM [database], which is automatically generated by SQL Server. It’ll highlight the “]”. That’s why I downgraded to 4192.
The new SQL syntax requires correct dialect to be selected as it supports MySQL (the default), T-SQL and PostreSQL, all of which use specific syntax or support unique statements/expressions/keywords/etc.
Identifiers (columns, …) wrapped into brackets is supported by T-SQL only, but is no valid syntax in MySQL or PostgreSQL. Same applies to various string literals and escape sequences as well as keywords.
In other words, despite a claimed ANSI SQL standard, there’s no standard SQL beyond very basic statements.
The old SQL syntax also failed on those details or just didn’t apply any scope to various dialects.
Using the wrong dialect of new SQL just fails in other ways as it attempts to scope sql statements more detailed - not saying it’s perfect.
To assign desired dialect (e.g. T-SQL or PostgreSQL) to sql extensions, use the “Always open this file with…” menu entry.
The only way to change dialect used in strings (e.g. Python, or PHP) is by overriding SQL.sublime-syntax. You can try DefaultSyntaxChooser or the simplified plugin proposed in https://github.com/sublimehq/Packages/pull/4279 to do so via Command Palette command “SQL: Select Dialect”.
already asked at Red highlighting on end square bracket for SQL