-
Notifications
You must be signed in to change notification settings - Fork 122
Hash in SQL string breaks syntax highlighting #327
Comments
Sorry I probably should have explained more what that exactly is doing for anyone not familiar enough with SQL. The hash is actually just a string literal hash, it has no special significance at this point in SQL as it's within single quotes. In PHP we're constructing the literal string: SELECT ' #' || fieldid FROM sometable which VSCode/Atom are correctly guessing is SQL (based on the The So if we have a single row in A little oddball I recognise, but I cut it down from a bigger snippet I hit in code that I was reviewing: $sql = 'SELECT v.assetid, a.name || \' #\' || v.fieldid as name, v.value
FROM sq_ast_mdata_val v, sq_ast a WHERE a.assetid = v.fieldid AND '; In this case |
Thanks for taking the time to contribute! We noticed that this is a duplicate of #321. You may want to subscribe there for updates. Because we treat our issues list as the Atom team's backlog, we close duplicates to focus our work and not have to touch the same chunk of code for the same reason multiple times. This is also why we may mark something as duplicate that isn't an exact duplicate but is closely related. For information on how to use GitHub's search feature to find out if something is a duplicate before filing, see the How Can I Contribute? section of the Atom CONTRIBUTING guide. |
I don't think that #321 is the same issue, that issue describes the quote spilling out past the end of the string and appears to be ok in the VSCode I'm currently running, e.g compare this highlighting: |
The root cause is the same: The sub-language (SQL) isn't terminating correctly, fixing the problem should fix this case as well. |
But in this case the sub-language SQL is actually terminating at the final quote. |
My apologies, at first glance they looked like the same thing, but this actually does look like a separate issue. It looks like this is a bug in the SQL sub-language where it isn't properly detecting that this is within a string. I'm guessing that it's because it's seeing the Leading credence to this theory is the fact that if you change the PHP string to be So this code highlights correctly: <?php
$sql = "SELECT ' #' FROM sometable"; Confirming this on Atom v1.27.0-beta0, which is using |
From microsoft/vscode#48096
Steps to Reproduce:
This code:
Highlights like so:
I guess this is a comment in SQL, but it seems hard to tell that it's actually inside a string.
The text was updated successfully, but these errors were encountered: