Adding new syntax highlight is a rather simple task (assuming the desired lexer exists in the Scintilla stack).

Under codelite's lexer settings folder ( ~/.codelite/lexers or APPDATA\CodeLite\lexers) you will find 2 files:

  • lexers_black.xml
  • lexers_default.xml

Each XML file represents a complete color scheme.

Add your lexer XML element at the end of the XML file, but before the enclosing </Lexers> tag

When adding a new lexer, it is best copying from one of the existing lexers and modifying it ( to get a working skeleton )

Each lexer is enclosed under the <Lexer></Lexer> tags
For example:

 <Lexer Name="MyLexer" StylingWithinPreProcessor="yes" Id="76">
 </Lexer>

The lexer's "Id" property must exist. Below is the list of available lexers and their respective IDs:

 wxSTC_LEX_CONTAINER 0
 wxSTC_LEX_NULL 1
 wxSTC_LEX_PYTHON 2
 wxSTC_LEX_CPP 3
 wxSTC_LEX_HTML 4
 wxSTC_LEX_XML 5
 wxSTC_LEX_PERL 6
 wxSTC_LEX_SQL 7
 wxSTC_LEX_VB 8
 wxSTC_LEX_PROPERTIES 9
 wxSTC_LEX_ERRORLIST 10
 wxSTC_LEX_MAKEFILE 11
 wxSTC_LEX_BATCH 12
 wxSTC_LEX_XCODE 13
 wxSTC_LEX_LATEX 14
 wxSTC_LEX_LUA 15
 wxSTC_LEX_DIFF 16
 wxSTC_LEX_CONF 17
 wxSTC_LEX_PASCAL 18
 wxSTC_LEX_AVE 19
 wxSTC_LEX_ADA 20
 wxSTC_LEX_LISP 21
 wxSTC_LEX_RUBY 22
 wxSTC_LEX_EIFFEL 23
 wxSTC_LEX_EIFFELKW 24
 wxSTC_LEX_TCL 25
 wxSTC_LEX_NNCRONTAB 26
 wxSTC_LEX_BULLANT 27
 wxSTC_LEX_VBSCRIPT 28
 wxSTC_LEX_BAAN 31
 wxSTC_LEX_MATLAB 32
 wxSTC_LEX_SCRIPTOL 33
 wxSTC_LEX_ASM 34
 wxSTC_LEX_CPPNOCASE 35
 wxSTC_LEX_FORTRAN 36
 wxSTC_LEX_F77 37
 wxSTC_LEX_CSS 38
 wxSTC_LEX_POV 39
 wxSTC_LEX_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xSTC_LEX_POWERPRO 95
 wxSTC_LEX_NIMROD 96
 wxSTC_LEX_SML 97
 wxSTC_LEX_MARKDOWN 98
 wxSTC_LEX_TXT2TAGS 99
 wxSTC_LEX_A68K 100
 wxSTC_LEX_MODULA 101
 wxSTC_LEX_COFFEESCRIPT 102
 wxSTC_LEX_TCMD 103
 wxSTC_LEX_AVS 104
 wxSTC_LEX_ECL 105
 wxSTC_LEX_OSCRIPT 106
 wxSTC_LEX_VISUALPROLOG 107

Next, edit the keywords set. If you don't need more than one keyword set, you can leave the other keywords empty.
For more information about which lexer requires more than one keyword set, refer to http://scintilla.org/

 <KeyWords0>my space delimited key word set</KeyWords0>
 <KeyWords1></KeyWords1>
 <KeyWords2></KeyWords2>
 <KeyWords3></KeyWords3>

Edit the file extensions so CodeLite can assign the new lexer to them:

 <Extensions>*.ext;*.ext2;*.lal</Extensions>

Last, the 'properties' section. Each lexer has several lexical states, and each of those can be assigned a different visual style (for example, in the C++ lexer, a comment is a state, so you might want to assign it a different colour and font; a preprocessor line is also a state which you would usually choose to colour differently; and so on and so forth).
Each of the above lexers, has a predefined state. to see the full list of states per lexer, search at wxStyledTextCtrl header file (a wxWidgets wrapper for Scintilla)

For example, the C++ lexer has the following states (scintilla's states are numbered from 0-n) - it is recommended to leave the 'Face' property empty; CodeLite will choose one for you from the FIXED WIDTH font family:

 <Property Id="0" Name="Default" Bold="no" Face="" Colour="#808080" BgColour="#FFFFFF" Size="9"/>
 <Property Id="1" Name="Comment" Bold="no" Face="" Colour="#008000" BgColour="#FFFFFF" Size="9"/>
 <Property Id="2" Name="Keyword" Bold="no" Face="" Colour="#0000FF" BgColour="#FFFFFF" Size="9"/>
 <Property Id="3" Name="Parameter" Bold="no" Face="" Colour="#800040" BgColour="#FFFFFF" Size="9"/>
 <Property Id="4" Name="Section" Bold="no" Face="" Colour="#400000" BgColour="#C8C891" Size="9"/>
 <Property Id="5" Name="Preprocessor" Bold="no" Face="" Colour="#808080" BgColour="#FFFFFF" Size="9"/>
 <Property Id="6" Name="Preprocessor (inline)" Bold="no" Face="" Colour="#808080" BgColour="#FFFFFF" Size="9"/>
 <Property Id="7" Name="Pascal comment" Bold="no" Face="" Colour="#008000" BgColour="#FFFFFF" Size="9"/>
 <Property Id="8" Name="Pascal keyword" Bold="no" Face="" Colour="#0000FF" BgColour="#FFFFFF" Size="9"/>
 <Property Id="9" Name="User defined keyword" Bold="no" Face="" Colour="#800080" BgColour="#FFFFFF" Size="9"/>
 <Property Id="10" Name="Double quoted string" Bold="no" Face="" Colour="#808080" BgColour="#FFFFFF" Size="9"/>
 <Property Id="11" Name="Single quoted string" Bold="no" Face="" Colour="#800000" BgColour="#FFFFFF" Size="9"/>

Where:

  • Id - the lexer's state Id as exist in wxStyledTextCtrl header file (a wxWidgets wrapper for Scintilla)
  • Name - any name
  • Bold - yes / no
  • Face - a font name (you can leave this one empty)
  • Colour - accepts format of HTML (#FF00FF), "rgb(r, g, b)" or colour name ("BLUE", "GREEN" etc)
  • BgColour - background colour for the state
  • Size - font size in pixels

Ids -1 to -3 and 33 to 35, and 37-38 are special; they should be in every new lexer you add:

 <Property Id="-1" Name="Fold Margin" Bold="no" Face="" Colour="#FFFFFF" BgColour="#D0D0D0" Size="9"/>
 <Property Id="-2" Name="Text Selection" Bold="no" Face="" Colour="#000000" BgColour="#C0C0C0" Size="9"/>
 <Property Id="-3" Name="Caret Colour" Bold="no" Face="" Colour="#000000" BgColour="#000000" Size="9"/>
 <Property Id="33" Name="Line Numbers" Bold="no" Face="" Colour="#004080" BgColour="#FFFFFF" Size="9"/>
 <Property Id="34" Name="Brace match" Bold="no" Face="" Colour="#000000" BgColour="#8BBF86" Size="9"/>
 <Property Id="35" Name="Brace bad match" Bold="no" Face="" Colour="#000000" BgColour="#FF0000" Size="9"/>
 <Property Id="37" Name="Indent Guide" Bold="no" Italic="no" Underline="no" Face="" Colour="#C0C0C0" BgColour="#FFFFFF" Size="9"/>
 <Property Id="38" Name="Calltip" Bold="no" Italic="no" Underline="no" Face="" Colour="#C0C0C0" BgColour="#FFFFFF" Size="9"/>
Edit - History - Print - Recent Changes - Search
Page last modified on June 08, 2016, at 11:17 AM