We heavily use SQL-Template-Strings (https://github.com/felixfbecker/node-sql-template-strings) but queries are not colored. This syntax allow SQL syntax highlighting in code like :
varquery=SQL` SELECT * FROM table where id = 1`;- Create a new syntax with
Tools -> Developer -> New Syntax... - Delete the exemple code
- Copy everything from the file js-sql.sublime-syntax in the oppened window
- Save as js-sql.sublime-syntax
Map the js-sql language definition to javascript in order to enable all js linters (jshint, eshint, jscs, etc) with js-sql syntax.
Open Preferences -> Package Settings -> SublimeLinter -> Settings - User and add the key-value entry "js-sql": "javascript" to the syntax_map object.
So now the default syntax_map object is:
"syntax_map":{"html (django)": "html", "html (rails)": "html", "html 5": "html", "php": "html", "python django": "python", "js-sql": "javascript" }- Open a js file
Ctrl+Shift+Pand typeSetSyntax: javascript-sqlorssjssql
Sublime Text memorize this choice and will open all js files with js-sql syntax by default.
MIT License. Copyright 2017 Asterisque Digital