Wrong variable colors


#1

Hello. I have several problems with variable coloring, it seems strange.

Look at the image, please:

So, the problems are:

  1. existingObject is black as parameter, but red in function body
  2. existingObj is black, while it is not defined
  3. existingObject.someProperty is red
  4. A is black, but if i use it as A.B, it is red
  5. [Non related] When i doubleclick variable the '’ character is not selected.

It is not theme (One Light - One Light), as I’ve changed default themes and they all seem to use strange coloring.

I find it strange because IDEs usually don’t color same variable differently, and don’t color different objects with same color. Current coloring not making much sense to me.

(I’ve used google)


#2

Atom does not currently use full parsers for detecting tokens and semantic meaning of tokens in text. Because of this, especially in dynamic languages, Atom may not syntax highlight things optimally. Atom uses the TextMate grammar system which parses things on a line-by-line basis (with some state carried over in between lines). There are efforts to make things as accurate as possible but until we change the underlying grammars, it will never be as accurate as many IDEs which do use full grammars (but are often limited to specific subsets of languages).


#3

I just updated Atom from 1.3.3 to 1.4.2 and now have the same strange syntax highlighting.

Screenshots comparing 1.3.3 to 1.4.2

Unfortunately I can’t inline the images in this post because I’m a “new user” (really annoying restriction), so you’ll have to browse to the imgur gallery. Both of these are taken with the One Dark syntax theme. Something has definitely changed between versions that broke syntax highlighting.