digitallyserviced / semanticolor

Provide Atom editor with semantic color highlighting.
https://atom.io/packages/semanticolor
MIT License
34 stars 3 forks source link

Colouring problems in Python #24

Closed pferreir closed 7 years ago

pferreir commented 7 years ago

See the way semanticolor handles .format(...) here:

image

I've seen this a few times in Python code. It looks like a bug to me. I used the "log cursor scope" feature and the identifier.semanticolor-* scope is indeed different. The other scopes are exactly the same.

sharedprophet commented 7 years ago

What other scopes are present for the f and the rest of the word? Aside from the semanticolor ones, is there a difference in the scope list?

pferreir commented 7 years ago

image image

sharedprophet commented 7 years ago

Hmmmmm... I'll look into it. Thanks. : )

pferreir commented 7 years ago

If it helps, it only seems to happen when an attribute follows a parenthesized expression (e.g. myfunc().myattribute).

sharedprophet commented 7 years ago

So, it seems this is a bug in the Python language grammar for Atom. The language-python-mamba grammar doesn't have this issue. Basically, the grammar is identifying the first letter and the rest of the word as separate tokens, for some reason. I could maybe open a PR to fix the grammar...

sharedprophet commented 7 years ago

Looks like there is some work going on around replacing the crappy language-python module: https://github.com/atom/atom/pull/13877

...I'm gonna close this as not a semanticolor issue. Hopefully you'll get some improved Python support soon! in the meantime you could try the language-python-mamba package, or just wait.

pferreir commented 7 years ago

Thanks for having checked. I think I'll just used MagicPython for now, but good to know!