Sample Header Ad - 728x90

Geany: Ruby comments in erb.html break the syntax highlighting

2 votes
1 answer
156 views
I use Geany (v1.123.1), my favourite text editor for code editing, as it's nice and simple. One thing which it doesn't do right is the syntax highlighting of comments, in erb files (a type of ruby template for web pages). In erb files, ruby code is injected with special "erb" tags like so:
and if we want render out the results, we put an = after the start tag, like so
These are both handled properly by Geany. However, it fails to handle erb comments:
which are treated like one of the previous ones, ie as if they contained actual code. This wouldn't be a disaster, except that they break the highlighting for the rest of the file, ie everything underneath. Eg see this screengrab: enter image description here What would be ideal is if it realised these were comments, and rendered everthing in the tag (perhaps including the tags themselves, I don't mind) in the same sort of grey/brown font used for other types of comments. Is there a fix for this, or can I edit the config myself, to make it process the comments properly? **EDIT**: I tried doing the following: In /usr/share/geany/filetype_extensions.conf, i added this line:
Erb=*.erb;
Then I created this file: /home/max/.config/geany/filedefs/filetypes.erb with these contents:
[styling=HTML]

[settings]

lexer_filetype=HTML
Then I closed geany, reopened it, and reloaded the config for good measure. But it hasn't made any difference. As per the answer below I also tried naming the local config file as filetypes.Erb.conf, but that didn't work either. I think it should be called filetypes.erb, following the format of the other config files.
Asked by Max Williams (1157 rep)
Feb 27, 2020, 12:05 PM
Last activity: Mar 3, 2020, 03:10 PM