tags:

views:

1934

answers:

3

Are there any plugins for eclipse that add syntax highlighting and other niceties for editing Haml and Sass? Google searches only seem to point to a dead project on lucky-dip.net.

Note: it's Sass I'm most interested in. A solution for using just Sass (or something similar to it like less) in Eclipse would suit my needs.

Also, I'm developing for Google App Engine (Java), using the App Engine plugin for Eclipse. So switching to another IDE isn't an option.


Update: So I've got syntax highlighting now using Pascal's answer and I've installed Ruby and Compass to compile sass into css.

However I'm aware that the syntax of sass will be changing with 2.4 so I'd still like to get the Haml and Sass Editors that come with Aptana to work. When I tried to use them they threw an exception and wouldn't display the files. I'd be interested to know if that's because I misconfigured Aptana or is an actual bug in the editors.

I'd also be very interested in any way of compiling Sass that integrated with Ecplise so that I didn't have to run something separate from it. (or a way of putting Sass/Compass in the Ecplise build process.)

+3  A: 

Well, what about Aptana? According to the Haml/Saas Syntax Highlighting in Aptana/Eclipse blog post:

Recently, I have been using Haml in some my Rails projects. It simply makes your views clean and readable. One issue I had was syntax highlighting in my favorite IDE, Aptana Studio. The Haml syntax highlighting support has been stopped a while ago and more issues have raised after Aptana recent updates.

After some research, I found a solution posted by Max Kostovetski, a member of Haml Google group. Now, to the steps:

  1. Download the following files to your hard drive:>
  2. From AptanaEclipse "Window" menu, select "Preferences..."
  3. In the the preferences window, select "Editors" > "Generic Text"
  4. Press "Add..." to add new file extensions: *.haml and *.sass
  5. For each of the new extensions, click it and press "Browse..." to select the proper lexer file (*.lxr)
  6. For colorization, press "Import..." to import the *.col files
  7. Press "OK"
  8. Enjoy you Haml views

PS: Refer to the original blog post as it provides up-to-date links.

Note: this can be used with the Aptana RadRails Eclipse plugin as well as Aptana Studio

UPDATE: At the time of writing, RadRails and Studio seems to support Haml and Sass so it might now be unnecessary to follow the steps above.


To compile SaaS in an "integrated" way inside Eclipse, you could maybe just use an External Tool (Run > External Tools). Another more elaborated option would be to add a "Program Builder" to your project's Builders like in this blog post. Of course, the described solution would require to be adapted to Saas but the principles behind it seems to apply. Caution: I didn't implement it myself, it's just an idea and I'm not even sure it makes sense.

Pascal Thivent
I'm developing for Google App Engine (Java), using the App Engine plugin for Eclipse. Switching to Aptana isn't an option.
Sam Hasler
Also, I'm not sure why that post mentions Eclipse, the instructions make no sense in it, and the lxr/col files don't appear to work with Eclipse either.
Sam Hasler
Hmm... I was suggesting to use the Aptana **Eclipse plugin**, not the standalone version. Then these instructions are indeed very close to http://www.mail-archive.com/[email protected]/msg01886.html that applies to Eclipse. I admit I didn't test this myself but I don't get why it doesn't make sense in Eclipse. Please keep me updated, I'm curious.
Pascal Thivent
I didn't realise Aptana was also an Eclipse Plugin. While installing the Aptana RadRails plugin there was an option to install Haml and Sass Editors. So this could be just what I needed, however I think I might have bungled the install as the Editor is throwing an exception.
Sam Hasler
Haaaaa, at least I understand what you're saying now. Regarding the exception, it's another story :)
Pascal Thivent
Sam Hasler
These instructions for using the .lxr and .col files to add syntax highlighting are no longer accurate as of Eclipse Helios. Something's evidently changed, perhaps the XText stuff?
Jonathan Hanson
A: 

While it doesn't appear that there are any HAML or SASS syntax highlighters yet, you may want to consider doing something along the lines of bringing VIM (which does have support for HAML syntax highlighting) into Eclipse via a few available plugins. Eclim might be a possibility (although, I have not used it - just trying to offer other alternatives).

Another options is to take an already existing Eclipse syntax highlighting plug-in and add syntax highlighting for Sass and/or HAML. Something like the Eclipse Colorer may be worth looking into.

JasCav
+1  A: 

Notice that latest EclipseColorer actually supports both HAML&SASS. It may be a good alternative choice if you don't need a full featured Aptana IDE, but just looking for an editor.

EclipseColorer also gives you better syntax mixin support: other languages inside of HAML are highlighted with respect of their syntax (mixins for ruby, javascript, css, even sass).

Igor
Thanks Igor, your plugin looks like it would suit my needs better than Aptana. I'll have to look at it next time I'm working on that project.
Sam Hasler