I found Colorer plugin in Igor's answer interesting, yet I use .scss file extention and it only works for .sass files. Here's how to make it support .scss file extension:
First install the plugin as normal. Select Install New software
in Help menu in Eclipse and add the following repository: http://colorer.sf.net/eclipsecolorer
. Now select this repository and you should see the Eclipse Colorer install option. There is no drag-install option AFAIK.
After install, goto Colorer plugin folder inside Eclipse's plugin directory. In my case that's eclipse/plugins/net.sf.colorer_0.9.9/
. There you'll have to modify 3 files:
- colorer/hrc/common.jar
- colorer/hrc/proto.hrc
- /plugin.xml
Before doing any of the below instruction, please backup all files in the folder in order to restore them if anything goes wrong.
Modifying common.jar
Extract common.jar to an empty folder. This is done as any normal tar.gz file. Once extracted you'll have to modify 2 files in it:
duplicate lines 53 and 53 in inet/haml.hrc
and change it to scss. The result should be like below:
<block start='/^((\s\s)*):(sass)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='sass:sass'/>
<block start='/^((\s\s)*):(scss)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='scss:scss'/>
now copy inet/sass.hrc
to inet/scss.hrc
and change the relevant lines. The resulting scss.hrc
should be like below:
<?xml version="1.0" encoding='Windows-1251'?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
"http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
<type name="scss">
<annotation>
<documentation>
SCSS Sassy CSS
</documentation>
<contributors><![CDATA[
Igor Russkih irusskih at gmail dot com
]]></contributors>
</annotation>
<region name="ClassSelector" parent="def:TypeKeyword"/>
<region name="IDSelector" parent="def:Keyword"/>
<region name="IncludeMixin" parent="def:Label"/>
<scheme name='PropertyNames'>
<regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
<inherit scheme='css:PropertyNames'/>
</scheme>
<scheme name="PropertyWrapper">
<block start="/~/" end="/(:|\s|$)/" scheme="PropertyNames" region10="def:Symbol"/>
<regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
<inherit scheme="css:Property"/>
</scheme>
<scheme name="scss">
<!-- property value after colon -->
<block start="/\M([\$\w\d\-]+)\s*(:)/" end="/\M([\x22\x27]|$)/"
scheme="PropertyWrapper" region02="def:Symbol"
/>
<block start="/(:)\s*\M([\w\d\-]+)?/" end="/\M([\x22\x27]|$)/"
scheme="PropertyWrapper" region02="def:Symbol"
/>
<regexp match="/^ \s* \M[\.\#\=\@\!] (?{def:Outlined}[\w\d\-]+ ) /x" />
<regexp match="/ \. (?{ClassSelector}[\w\d\-]+ ) /x" />
<regexp match="/ \# (?{IDSelector}[\w\d\-]+ ) /x" />
<regexp match="/ [\=\+] (?{IncludeMixin}[\w\d\-]+ ) /x" />
<regexp match="/[\(\)'"]/" region='def:Symbol'/>
<regexp match="/\/\/.*$/" region='def:Comment'/>
<regexp match="/\@(import|extend|mixin)/" region='def:Keyword'/>
</scheme>
</type>
</hrc>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Colorer Library.
-
- The Initial Developer of the Original Code is
- Igor Russkih <irusskih at gmail dot com>
- Portions created by the Initial Developer are Copyright (C) 2010
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
after this, run the following command in the folder where you extract common.jar to recreate the jar file:
jar cf common.jar *
then substitute the original jar file by this one.
Other files
Now, include scss extension in /plugin.xml
line 37:
extensions="xml,xsd,xsl,dtd,hrc,hrd,html,htm,xhtml,rhtml,erb,yml,haml,sass,scss,css,asp,aspx,jsp,fo,svg,dbk,docbook,jhtml,jspf,php,php3,php4,phtml,sgm,sgml,shtm,shtml"
And finally, duplicate lines 200-203 in colorer/hrc/proto.hrc
. The result should be like below:
<prototype name="sass" group="inet" description="SASS">
<location link="jar:common.jar!inet/sass.hrc"/>
<filename>/\.(sass)$/i</filename>
</prototype>
<prototype name="scss" group="inet" description="SCSS">
<location link="jar:common.jar!inet/scss.hrc"/>
<filename>/\.(scss)$/i</filename>
</prototype>
After this restart eclipse and you should have syntax highlighting for .scss files.