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

Tory Gaurnier torygaurnier at xxxxx
Mon Sep 23 18:56:10 UTC 2013

On 09/23/2013 11:37 AM, Tory Gaurnier wrote:
> So far what I can tell by looking at the Geany source, I added my 
> qml.c file to the ctags folder, in qml.c I only changed one variable 
> type, filePosition (from fpos_t to MIOPos). I edited parsers.h adding 
> my qml parser to the end of the list, I edited the Makefile to add 
> qml.c, then in filetypes.h I added the qml filetype id to the enum 
> list, then in filetypes.c I added it as such:
> #define QML
>     ft = filetypes[GEANY_FILETYPES_QML];
>     ft->lang = 45; // 45th in the ctags list, I was supposed to do 
> this, right?
>     ft->name = g_strdup("QML");
>     filetype_make_title(ft, TITLE_SOURCE_FILE);
>     ft->mime_type = g_strdup("text/x-qml");
>     ft->group = GEANY_FILETYPE_GROUP_MISC;
> It compiles fine, and runs, but it's not showing up under filetypes.
> There must be something I'm missing but I just can't seem to find it.
Ok, well, I forgot about the lexer part, so I added it in in the same 
way Javascript is, in highlightingmappings.h I added this:
/* QML */
#define highlighting_lexer_QML        SCLEX_CPP
#define highlighting_styles_QML        highlighting_styles_C
static const HLKeyword highlighting_keywords_QML[] =
     { 0, "primary",        FALSE },
     { 1, "secondary",    FALSE }
#define highlighting_properties_QML    highlighting_properties_C

Which is exactly how JS works in this, it's just using the C lexer. In 
fact I did a global search for 'JS' in all the source files to see where 
it was being added, the only other things I saw were in HTML sections 
(for when it's embedded in HTML). So now, I can really say I can't find 
anything else, I know I'm still missing something, but I just can't find it.

More information about the Devel mailing list