Sublime Forum

SQL syntax highlight for string ending in backslash

#1

If a string in an SQL file ends in a backslash, the backslash acts as an escape character. ST3 thinks the string has not ended, which adversely affects the syntax highlighting for the rest of the file. This issue is described further here:
SQL syntax highlighting for /’ in string
Disable backslash as escape

Since the SQL I write is not intended for MySQL, I had previously fixed the issue (as suggested in the above posts) by modifying the “SQL.tmLanguage” file (located within the compressed “SQL.sublime-package” file). However, as of ST3 Build 3103, that file appears to have been replaced with a “SQL.sublime-syntax” file, and so far I am unable to determine how to modify it in order to fix this issue.

To avoid affecting the rest of the file, I have been adding a commented single-quote after each “offending” line, but this is a poor workaround. Can anyone suggest a fix that does not require a change to the SQL file?

0 Likes

#2

I just downloaded ST3 yesterday, so I’m very new to this. I work primarily in Oracle SQL and also wanted to disable how the backlash was handled in a single-quoted string.

I’m not sure if there is a way to avoid editing the syntax file, but you can create a new one that won’t be overwritten in the next update. I unpacked the contents of SQL.sublime-package into a new subfolder in the Packages/User folder. I then commented out these two lines:

  • include: string_escape

I also changed the name to PL/SQL to distinguish it from ST3’s SQL. As far as I can tell, the backslash no longer affects strings.

I’m sure there’s a more elegant solution, since this is about the only thing I’ve done with ST3 so far. :slightly_smiling:

1 Like

#3

you can open an issue at github

0 Likes