Page 1 of 1

How to add syntax highlighting for new language?

Posted: Sat Apr 01, 2023 9:38 am
by bprlhe

The information on wiki is outdated: https://wiki.codelite.org/pmwiki.php/Ma ... ngNewLexer

What I see is only a big lexers.json file that contained syntax highlighting for all languages in all themes.

p/s: the language is not in lexilla.


Re: How to add syntax highlighting for new language?

Posted: Sat Apr 01, 2023 10:54 am
by eranif

If the language is not in lexilla, then you are left with custom coloring using wxSTC_LEX_CONTAINER -> the container should perform the coloring (similar to how CodeLite colors in the "find-in-files" tab)

See here:
https://github.com/eranif/codelite/blob ... w.cpp#L188


Re: How to add syntax highlighting for new language?

Posted: Sat Apr 01, 2023 3:17 pm
by bprlhe
eranif wrote: Sat Apr 01, 2023 10:54 am

If the language is not in lexilla, then you are left with custom coloring using wxSTC_LEX_CONTAINER -> the container should perform the coloring (similar to how CodeLite colors in the "find-in-files" tab)

See here:
https://github.com/eranif/codelite/blob ... w.cpp#L188

So I will have to write C++ code? I don't know C++. If Settings -> Colours and Fonts... -> Customise colours per language has an add button so I could add my new language here and do everything via a graphical interface. Manually editing lexers.json is not a solution for me.