Rails highlighting like ACE Cloud9


#1

I use Ruby on Rails and I desperately try to find the right syntax highlighting package for atom. Ruby is for designers thus syntax highlighting plays a very important role here.

This image is an example from Cloud 9 Editor. The code is much more readable. Is there already a package that would make my code nicely colored like in ACE (note that if: presente: true is also properly colored)?


#2

It’s not really clear what you’re asking for – what’s wrong with Atom’s Rails highlighting right now compared to ACE?


#3

Hey @mnquintana. Please check the with_options line - if:, unless: and in next line presence has different colors from other sym methods. At the moment everything is colored with the same color.


#4

Which syntax theme do you have active? Atom Dark?


#5

Well, I’ve tried 20+ themes and all have the same problem (including Atom Dark). Currently I use Monokai Syntax Theme with Atom Dark UI Theme.


#6

Btw… I saw that many packages/themes are ported from TextMate which also have this problem.


#7

Yup that’s probably why. One Dark / Light don’t have this problem though – if there’s a syntax theme you prefer to those though it might be worth opening an issue on that theme’s repo to enhance their colors for Ruby.


#8

Hum… I see… “One Dark” colorize the presence: true like is should but if: :something is still in the same color.


#9

That’s true. To be honest I’m not sure if the way ACE does it is a bug or a feature – it’s only colorizing those specific hash keys (if:, unless:) because they happen to be language keywords. You would probably get the same highlighting if you wrote class: or do: or def:. Whereas Atom is treating them as they are – symbol hash keys.


#10

Aha… well ok… Thanks for your help. One Dark theme should do the trick for now :).


#11

I think it’s mostly a matter of rule order, if the keyword rule appear before the symbol rule it will catch if:, unless: and other keywords as symbols before the symbol rule. Personnaly I don’t mind as generally when keywords are used as symbols they carry a special meaning so I like having them standing out. But you can fix this by putting the symbol rule before the keyword rule in the ruby grammar.