p-e-w / language-javascript-semantic

JavaScript Semantic Highlighting Package for Atom (NO LONGER MAINTAINED)
MIT License
81 stars 17 forks source link

Mute Methods - Avoiding the Christmas Tree Effect #6

Open ThaisRobba opened 10 years ago

ThaisRobba commented 10 years ago

I really like semantic highlighting - but the current implementation is a bit too crazy on colors. I can't find my variables or what is happening to them - and reading code is nearly impossible when chaining.

Muting method calls, I believe, would be extremely beneficial. On the left is the current implementation, on the right is the same code but with muted methods (using this demo http://brooks.io/syntax-highlight/v2/). I was thinking that built-in method calls could be the same color and style as built-in keywords (so .length would be the same color as var). User-made methods could be a different shade of gray.

PS: Of course, there might be another way or a better solution. As it is, it is unusable with many frameworks.

colors

mik01aj commented 9 years ago

+1

mattsawyer77 commented 9 years ago

+1

mik01aj commented 9 years ago

Imho all method calls could me muted. The same for fields referenced by dot. So that the only thing that would get semantically-highlighted would be the local (or closure) variables and functions. Then we don't need any blacklists for frameworks.

p-e-w commented 9 years ago

Regrettably, this is not possible with the current setup as Acorn only gives us the scope name, not whether it refers to a method or variable. We could get much, much more information if we were able to let Acorn parse instead of just tokenize, but the Atom API demands that grammars be able to process source line-by-line, which is not compatible with Acorn's parsing model.