3

In the most recent version of Sublime Text (3.2 Build 3200), I have encountered what I think is a syntax highlighting error when writing in Python. Whenever I create a dictionary that has a key/value pair where the variable that represents the value starts with "for", the comma at the end of the line and all subsequent lines in the dictionary is highlighted pink. For instance:

{
    "test": fordgtths,
}

In my editor, the comma in the above text is highlighted pink. When I change the variable so that it does not start with "for", the highlighting error goes away. Is this in fact an error, or is there something obvious I'm missing? Is there a way to fix it, or do I just need to wait for a patch?

1 Answer 1

3

It is, in fact, a bug that they are going to fix with the next update. However, for now, people can manually apply the fix themselves. See the pull request here:

https://github.com/sublimehq/Packages/pull/1896/commits/c0d0c4753162c2f4aef417c1f29fc17ff5a73e60

Essentially, you need to go to your Sublime Text installation folder, then the Packages folder. Find the Python.sublime-package file, which is a .zip file. Rename it so that it has a .zip extension, and go into it. Then open the file called Python.sublime-syntax. On line 1006, you should see

match: (?=for)

Change this to

match: (?=for\b)
1
  • And then re-zip the edited folder, delete the unzipped folder and old file, and rename the new zipped file to Python.sublime-package.
    – Brendan W
    Commented Apr 5, 2019 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .