[Geany] Detecting user-defined filetypes?

Colomban Wendling lists.ban at xxxxx
Tue Jun 19 18:49:00 UTC 2012


Hi,

Le 19/06/2012 20:25, Worth, Kevin a écrit :
> I wanted at least some basic syntax highlighting for protocol buffers
> (http://code.google.com/p/protobuf/) files, so I simply copied filetypes.c
> to ~/.config/geany/filetypes.proto.conf and changed the following lines:
> 
> [keywords]
> primary= import message enum service extend required optional repeated
> rpc returns option extensions to
> secondary= double float int32 int64 uint32 uint64 sint32 sint64 fixed32
> fixed64 sfixed32 sfixed64 bool string bytes default java_package
> java_outer_classname optimize_for  cc_generic_services
> java_generic_services py_generic_services message_set_wire_format packed
> deprecated
> 
> [settings]
> extension=proto
> lexer_filetype=C  #protobuf is C-like enough that this works ok, maybe
> there are better choices...

comments at the end of line doesn't work in the filetypes configuration
file.  make sure your comment is on it own line.

> This works well enough, but when I open a .proto file, I have to manually
> select Document->Set Filetype->proto file. I tried adding a line to
> /usr/share/geany/filetype_extensions.conf, but that doesn't seem to make
> geany use my filetypes.proto.conf when I open a .proto file.
> 
> The docs are a little obtuse in how they explain some of this;
> a step-by-step would be helpful.

I guess you added

	Proto=*.proto;

to filetype_extensions.conf?  If yes, either remove the uppercase P on
the langauge name or rename the filetype file as filetypes.Proto.conf
(with the uppercase P).  These two must match exactly or it won't work.

BTW, you don't need to edit the system's filetype_extensions.conf, just
copy it to your homedir and modify this one, or use the
"Tools->configuration files" facility.


Regrads,
Colomban

> Also if anyone knows of work that's been done to create a protobuf
> lexer and tags for geany, I'd love to know.
> 
> -Kevin



More information about the Users mailing list