Client Login Button
username   password    

» 30Points Blog

Fixing e-texteditor to Properly Highlight View Layouts in Rails 2.0.2

For Windows-based Ruby on Rails developers, the e-texteditor is an excellent editor to use for your work. It’s a work in progress but the features are based on the highly acclaimed editor, TextMate for Mac OS X. In fact, most of the “bundles” are directly compatible between the two clients.

In Rails 2.0.2, view layout files were changed to use the .erb file extension instead of the previeous .rhtml. This means that editors that use file extensions to determine which syntax highlighting pattern to load will no longer highlight your Rails views properly.

Oh noes! Our highlighting is gone!

In order to correct this we’ll need to edit our Rails bundle to include .erb files in the files we use our Rails syntax highlighting for.

Start by going to the menu bar in e-texteditor and select: Bundles -> Edit Bundles -> Show Bundle Editor. This will give you your bundle editing screen as shown below:

So this is where the bundles live!

Scroll down until you find the “Rails” bundle. Expand that and scroll down to find the HTML (Rails) section. Click this section and you will be presented with the bundle text itself used to determine highlight rules. We’re looking for a spot in this section where the file associations are listed. See below:

Here\'s what we have to change.

Change the filetypes association language to include erb files shown below:

Change this line

Presto! Close the editor (no need to save, it does it automagically) Now open a .erb view and your syntax highlighting should work again just as shown:

Fixed text highlighting

I imagine future versions of the Rails bundle will account for this automatically. There is a similar fix procedure for fixing TextMate for Rails 2.0.2.

Hope this helps.

Tags: , , , , , , ,


Leave a Reply