.erb files do not format properly in editor?

Answered

When opening a standard .erb file in an editor, it appears as plain, simple text; there's no color on tags, comments, etc; just white text. Also, the Structure view will not display anything, and the entire ide chokes up for a few seconds when attempting to view structure. I was hoping it would appear like an html file, with colors indicating tags, attributes, and so on. I'm thinking there's some sort of editor setting I'm missing, or possibly a problem of some sort, and searches have yielded nothing helpful. Any pointers on how to make the editor somewhat better than using TextEdit would be appreciated; thanks.

13 comments
Comment actions Permalink

Hi,

could you please heck if the file is added to list of plain text files (Settings|File Types)

Regards, Oleg.

0
Comment actions Permalink

the .erb extension is not registered with Text, but is registered with RHTML, along with rhtml. Also, the file itself does show as being recognized as such in the Project view panel. Thanks.

0
Comment actions Permalink

Hi,

it is possible to add exact file name to the list of files for a file type.
Is the problem reproducible with simple ruby project with the only file which is .erb?

Regards, Oleg.

0
Comment actions Permalink

I just created a simple test project and it works fine. But any .erb file in the existing project that I'm experiencing this will treat standard html tags as plain text; no colors, no formatting, no structure views. If I copy the original markup into the new project in an .erb file, it displays as expected, and the structure also works.

0
Comment actions Permalink

Do you have any other ideas on how to correct this? Thanks.

0
Comment actions Permalink

Invalidating Cache and restart doesn't help

0
Comment actions Permalink

I discovered a work around fix, which is to rename the file to just .html, dropping the .erb extension, then rename it back with .html.erb; it then displays properly. It's a workaround, but I can live with it. Still, this seems to be a pretty big problem, in my opinion.

0
Comment actions Permalink

Actually, I spoke too soon. The refactor rename method doesn't work, either. I'd originally modified the name of the file on the file system directly, because using the refactor tool seemed to want to change several other references, and I didn't want to update those. After renaming it to just index.html, then attempting to refactor the name back to using the .erb extension, I discovered that it didn't actually work. In fact, it then changed the name to index.html.erb.html. Awesome. So, I deleted the file altogether, then just created a new index.html.erb, pasted in the original content, and right back to the original problem.

0
Comment actions Permalink

Hi,

if renamed file is highlighted correctly then I'd doublecheck list of all ignored files and files listed in Plain Text file type (see Settings|File Types)

Regards, Oleg

0
Comment actions Permalink

Already checked that; the .erb is listed under RHTML, and is not present under the Text type, or in the ignored patterns. Additionally, this is only ocurring in one project, but in that project, all .html.erb files are displaying incorrectly like this. I created a test project, and was able to get identical markup from the problem project to format and display properly in it. Thanks.

0
Comment actions Permalink

I was having the same issue, and I had to explicitly add .html.erb to the RHTML list of files

0
Comment actions Permalink

tried that, but still not behaving. Thanks.

0
Comment actions Permalink

I just had this issue and found a way to resolve.

For some reason, I was adding a file via the IDE and accidently typed in .ervb instead of .erb. It then somehow wound up adding a wildcard *.erb to an XML file format. Once I removed that from the list, everything went back to the way it was before. In RHTML, the .erb extensions was still there. Seemed to be the IDE was getting confused at to what the explicit .erb extension was doing.

TL:DR

Check the file extensions for file formats and see if *.erb is added anywhere it shouldn't be.

0

Please sign in to leave a comment.