How to add syntax highlighting for new language?

General questions regarding the usage of CodeLite
bprlhe
CodeLite Curious
Posts: 4
Joined: Sat Apr 01, 2023 9:21 am
Genuine User: Yes
IDE Question: C++
Contact:

How to add syntax highlighting for new language?

Post 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.

User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to add syntax highlighting for new language?

Post 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

Make sure you have read the HOW TO POST thread
bprlhe
CodeLite Curious
Posts: 4
Joined: Sat Apr 01, 2023 9:21 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to add syntax highlighting for new language?

Post 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.

Post Reply