[Geany-Devel] Colour scheme woes

Lex Trotman elextr at xxxxx
Mon Mar 23 01:45:49 UTC 2020

On Mon, 23 Mar 2020 at 10:23, Austin Green <austin.green at orcon.net.nz> wrote:
> On Sun, 22 Mar 2020 14:03:29 +1000
> Lex Trotman <elextr at gmail.com> wrote:
> > These are syntax highlighters, they only distinguish syntax, not
> > semantics or symbols.
> >
> > It would therefore only be possible if functions are _syntactically_
> > distinguishable from any other names, but that's not the case in most
> > languages (including C and C++).
> I take your point, but I guess it depends to some extent on the overall design of the syntax analyser.  The editor 'vim', for example, manages to colour functions for Rust, though not for C/C++, while 'SlickEdit' (whose colour scheme I was wanting to copy) manages to do it for functions in C/C++ as well.

And Visual Studio and VScode, and Eclipse but their colouring isn't
just syntax, they fully parse the files in the build context so they
can find includes, which means they have seen the declarations of
names and then can handle them correctly.  Scintilla lexers are
(deliberately) just lexers, they do not parse declarations or
expressions and they have no API for the symbol parsers in Geany to
supply the information.  We do (ab)use the keyword lists to get type
names coloured differently, but that fails when the same name is used
in another context, then it will be coloured as type no matter what it
is.  That probably would be very slow if all function names were
included, and the overlaps would be greater.

Slickedit looks like it does the same as these IDEs to colour functions.

There was an experiment with using Clanglib to supply the colouring,
but it needed too many associated changes in Geany and was abandonned.


> Don't think I can find the energy to try to hack Scintilla's lexers right now, and it's not essential, just a 'nice to have' feature.
> Cheers,
> Austin.
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel

More information about the Devel mailing list