Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use with capitalized version SQLselect * from foo; #10

Open
ViktorQvarfordt opened this issue Sep 21, 2019 · 3 comments
Open

Enable use with capitalized version SQLselect * from foo; #10

ViktorQvarfordt opened this issue Sep 21, 2019 · 3 comments

Comments

@ViktorQvarfordt
Copy link

E.g. this repo uses the capitalized version: https://github.com/felixfbecker/node-sql-template-strings

@ViktorQvarfordt ViktorQvarfordt changed the title Enable use with capitalized version ` SQLselect * from foo; ` Enable use with capitalized version SQLselect * from foo; Sep 21, 2019
@azerum
Copy link

azerum commented Jan 26, 2023

Is there any other reason why you want to use the capitalized version? Because you can import the function from that library as lowercase:

const sql = require('sql-template-strings');

@azerum
Copy link

azerum commented Jan 29, 2023

As far as I understand, node-sql-template-strings currently does not support escaping identifies with ??, so I often find the need to write SQL query in plain string. However, this way I loose syntax highlighting

While hacky, the solution might be to allow users to configure list of string prefixes that should trigger SQL syntax highlighting. This way, I could add custom prefix rawSql that would not modify string in any way, but would cause this extension to highlight the code. You can also add SQL to the list, to use the capitalized version

@azerum
Copy link

azerum commented Jan 29, 2023

Reading vscode issues like this one, there seem to be know way to make configurable TextMate grammar

As a workaround, this extension can highlight string after any prefix that contains sql, case insensitive. So rawSql, sql, SQL, mySqL all will work. Not sure if it's good idea, but I use it locally

To support it, just replace the regex in "begin" with this one: "(?i)\\b(?=\\w+`)(\\w*sql\\w*)((`))"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants