-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feature request: Ignore leading whitespace for SQL detection #109
Comments
+1 for this, especially considering multiline string literals in C# must start on the next line as well as being indented up to the depth of the closing quotes |
Relevant additional information here is the difference between // syntaxes/c-sharp-multiline.json
// Add this to the patterns array
{
"comment": "C# multi-line raw string literals",
"begin": "(\"\"\"\\n\\s*)(SELECT |INSERT INTO |DELETE |UPDATE |CREATE TABLE |CREATE INDEX)",
"beginCaptures": {
"2": {
"name": "keyword.sql"
}
},
"end": "(\"\"\")",
"patterns": [
{
"include": "source.sql"
}
]
},
{
"comment": "C# multi-line raw string literals",
"begin": "(\"\"\"\\n\\s*)(--\\s*sql)",
"beginCaptures": {
"2": {
"name": "comment.sql"
}
},
"end": "(\"\"\")",
"patterns": [
{
"include": "source.sql"
}
]
} Edit: never mind, the current setup for this plugin depends on |
In our code, our queries often look like this:
The leading whitespace is helpful for keeping the queries aligned and tidy. Unfortunately, it also prevents the extension from detecting SQL. I recognize that I can use
--sql
at the beginning of the query but not everyone uses this extension. My request is to usetrimStart()
before checking the beginning of the string constant for a matching keyword.The text was updated successfully, but these errors were encountered: