[Geany-Devel] Interested making a patch to add QML support

Matthew Brush mbrush at xxxxx
Tue Sep 17 21:02:22 UTC 2013


On 13-09-17 08:02 AM, Tory Gaurnier wrote:
> I'm interested in making a patch to add QML support to Geany, but first
> I had a few questions. First of all, is anyone else already working on
> this? And if not, if I manage to get it working well would my patch be
> worked into the main Geany code so others could get it also? I've been
> learning programming for a while, but I've never patched or edited
> anyone else’s code, so I'm not making promises how fast I'd be able to
> get this done, of course from looking at the hacking page it doesn't
> look to complicated to add support for another language, I just wanted
> to ask these questions before I even attempted this.
>

To answer your questions first; no, no one is working on it AFAIK, and 
if you follow the guidelines and write decent code, yes, I'm sure we 
would include it Geany. I'd rather like to use QML in Geany myself as I 
find QtCreator to be way too big and slow for something so simple (even 
if it's quite nice overall).

You found probably the most important info already (notes in HACKING 
file), so that's a good start :)

We use Scintilla[1] for the editing component as you probably know, and 
it seems like no one is working on this, though someone talked on the 
their mailing list[2] about starting to work on one last year. In order 
to get syntax highlighting support for QML, you'll need to code up a 
lexer in C++ (actually very C-like C++) and get it included into 
Scintilla project. With that, we can pull it downstream and integrate 
into Geany.

We use a fork of CTags[3] inside Geany for tag/symbol parsing, so in 
order to have that supported for QML you'll need to code up a parser in 
C and ideally get it included into CTags, but more likely we could just 
pull it into Geany directly first.

With those two things done, which aren't exactly trivial, but for a 
language like QML, probably aren't super difficult, then you can do the 
stuff in the HACKING file to integrate everything into Geany, which is 
the easiest part.

> Honestly it'll probably take me longer to figure out how to create and
> submit the patch then it will to actually change the code in the source
> itself.
>

Naw, writing the Scintilla lexer and Ctags parser will probably be the 
hardest part as writing lexers and parsers isn't the easiest thing in 
the world (especially in C and C++). The rest is just learning how to 
use the version control system and common knowledge you can find online 
about best practices for making commits and using the tools (in our case 
Git, and Mercurial for Scintilla - which is quite similar). If you work 
in features branches, and make small incremental commits, you can go 
back after and re-jigger everything into nice clean patches for Geany 
and Scintilla.

All that being said, if you aren't a strong C programmer and have no 
interest in becoming one, all of this is probably way too much trouble 
for what it's worth :) Unfortunately adding new proper language support 
to Geany is quite difficult compared to most editors. Alternatively, you 
might be able to get reasonable results by re-using existing filetypes 
in Geany, maybe basing it on JavaScript or something more similar to 
QML. Check Geany's manual for "custom filetypes"[4] for more info on 
this much easier approach, there's a few existing examples of these kind 
in Geany's source tree[5].

Cheers,
Matthew Brush

[1] http://www.scintilla.org/
[2] 
https://groups.google.com/d/msg/scintilla-interest/jxch35Fue2k/ExZcjlrHdRkJ
[3] http://ctags.sourceforge.net/
[4] http://www.geany.org/manual/current/index.html#custom-filetypes
[5] https://github.com/geany/geany/blob/master/data/filetypes.Cython.conf


More information about the Devel mailing list