barklan / inline_sql_syntax

Highlight and lint inline SQL strings.
https://marketplace.visualstudio.com/items?itemName=qufiwefefwoyn.inline-sql-syntax
MIT License
58 stars 25 forks source link

fix: Handle identifiers wrapped in " #57

Closed nossrannug closed 2 years ago

nossrannug commented 2 years ago

Queries containing " inside them were not handled correct. The reason was that when checking all the regex "--sql was checked before """--sql but the first would match the latter. So when wrapping python stings with tripple quptes it would think it was "--sql and end the string on the first " it found which could have been wrapped around a column name. e.g.

sql = """--sql
    SELECT "group" FROM some_table;
"""

This would only match the SELECT and then stop because it encountered a ".

barklan commented 2 years ago

Thank you! Will publish pre-release in a moment.

barklan commented 2 years ago

Skipped pre-release, relased in 2.13.2