Sublime Forum

Python SQL Highlighting

#1

Hello!

This is my first post so hopefully I’m providing enough needed information.

I’m on Windows using Sublime Text Build 4126.

Unless I’m missing something it appears to me that when set to Python syntax (3.6.8 if that matters) there are a few ways to break the SQL highlighting.

Method 1:

  • Using multi-line quotes - begin your SQL statement with either a block or in-line comment

Method 2:

  • Using any f-string quote style (even if it has no reason to be an f-string)

I’m not sure if it’s possible to have sublime understand the mixed syntax or not, but it would be very helpful to have these blocks of code colorize more precisely. I did play around with Python.sublime-syntax and found I could tweak things to recognize the f-string starting syntax, but it then broke the inner highlighting for the f-string content of the string. I figured it was worth posing the question to all the experts here to identify if this could be fixed.

Thank you in advance for reading and considering what’s possible!

1 Like