MattDMo / PythonImproved

The best Python language definition for Sublime Text - ever. Includes full support for Unicode, as well as both Python 2 and Python 3 syntax. Check out the Neon Color Scheme for highlighting.
https://packagecontrol.io/packages/Python%20Improved
MIT License
93 stars 11 forks source link

Constant detection is random #40

Closed hyperknot closed 9 years ago

hyperknot commented 9 years ago

Some random variables are detected as constants, while others are not. By adding or removing one character from the beginning, they change colour:

screen shot 2015-05-23 at 14 59 31

MattDMo commented 9 years ago

Please make sure you've upgraded to the latest version of Python Improved. The alternate highlighting you are seeing is left over from when I included Django constants as their own scope. However, it was annoying to keep both current and backwards-compatible, and I don't think many people were using it, so I removed it. Go to Preferences -> Package Control, type in _pcu_ (for Package Control: Upgrade), scroll down the list to Python Improved, and hit Enter. Depending on your platform, version, phase of the moon, etc. you may need to restart Sublime and/or close and reopen the file you're working on to see the differences. It looks like you're using my Neon Color Scheme, so after you upgrade all constants (words that are in ALL_CAPS, optionally containing numbers after the first character) should be in the yellowish-brown color like you see now for CSRF_COOKIE_HTTPONLY.

Please let me know how it works.

(BTW, you might be using an old version of Neon as well - you could try upgrading that, too.)

hyperknot commented 9 years ago

I've checked, and i'm on the latest version of everything: 1.4.2 from PI and 1.2.1 from Neon.

However, upon checking I think I've found why is it happening. I've installed 'Djaneiro' package for syntax highlighting Django themes, but it has provided it's own Python syntax as well and it seems to "steal" the .py extension from PythonImproved.

So actually Sublime wasn't using PI for that file, but that crazy Djaneiro syntax.

MattDMo commented 9 years ago

Yeah, it does that. That was one of the original reasons why I added the Django stuff to PI in the first place, so I wouldn't have to deal with Djaniero craziness :grinning: Glad you figured it out!