wiki:Features/SyntaxHighlighting

Syntax highlighting or syntax coloring

In 0.84 you could switch between styles in View -> Styles ->

Starting from 0.85 the option moved to Tools -> Preferences -> Appearance -> Style ->

You can also create your own style:

To set up a custom syntax highlighting scheme, you create a .yml file that defines a mapping from syntactic elements to colors. The easiest way to create your own scheme is probably to copy an existing style file (for instance, default.yml) from the share/styles/ folder of Padre. Put it in styles subdirectory of your padre configuration directory, and then modify it. Padre checks this folder on start-up and adds any styles in the YAML files there to the list of available styles.

You can find out where is the Padre configuration directory on your computer by looking at Help -> About -> System Info -> Config

=head2 Syntax highlighting

Padre is using L<Wx> (aka wxPerl), wxWidgets for GUI and Scintilla for the editor. Scintilla provides very good syntax highlighting for many languages but Padre is still bound by the version of Scintilla included.

The F<share/styles/default.yml> file is the mapping between the Scintilla defined constants for various syntactical elements of each language and the C<RGB> values of the color to be used to highlight them.

Adding new syntax highlighting

TO DO does this stuff below really belong here?

Need to define constants in Padre::Util to be in the Padre::Constant namespace.

Need to add the color mapping to share/styles/default.yml

Need to implement the Padre::Document::Language class.

Need to define the MIME type mapping in Padre::Document

For examples see Padre::Document::PASM, Padre::Document::PIR and Padre::Document::Perl.

Tickets

Ticket Resolution Summary Owner Reporter
#1477 default color scheme is too flickering vsespb
#1348 Add support for additional keyword lists in Scintilla LexPerl submersible_toaster
#1331 Specially Handle Escaped characters ktaragorn
#1284 osx Wx::Scintilla .21_04 causes Padre to scroll poorly azawawi tome
#1282 invalid Wx::Scintilla v0.21_02 and TABS azawawi bowtie
#1233 syntax highlighting for specific heredocs zenogantner
#1215 wontfix Cannot change the syntax highlighter of Perl 6 szabgab
#1214 duplicate highlight variables interpolated into strings szabgab
#1205 When getting the color scheme from Notepad++, get MY color scheme Lady_Aleena
#1194 not relevant PPI Experimental & Skeleton Build bowtie
#1191 Disable highligher during mass open azawawi Sewi
#1109 fixed PPI Lexer crash when loading file zenogantner
#1028 invalid Syntax highlighting in Padre using Colorer szabgab
#1011 Syntax highlighting for Perl examples inside POD zenogantner
#994 wontfix PPI syntax highlighter does not highlight some keywords/built-in functions zenogantner
#993 fixed BibTeX files: Scintilla is not shown as highlighter in the status bar zenogantner
#916 fixed Perl syntax highlighting: highlight interpolated variables and special characters in strings zenogantner
#914 Syntax highlighting for POD files zenogantner
#913 fixed almost no syntax highlighting for C code zenogantner
#779 Add support for Template Toolkit files adamk
#751 Proper XS lexing/highlighting tsee
#745 [Perl 5 syntax highlighting] delimiter used in extended regular expressions displays wrong azawawi daxim
#618 wontfix Minimalistic syntax highlighter? Floyd-ATC
#480 fixed Custom style setting fails to load on padre restart bricas
#305 not relevant Make it extreamly easy to add a syntax highlighter manage them szabgab
#251 wontfix Disable syntax highlighting after __END__ keyword dlp
#101 fixed syntax highlighting gone wrong: dor (//) not understood azawawi jquelin
#6 fixed Support the highlighting of more file types szabgab

Test

  1. In Tools/Preferences/Files? and Colors Select File Type: Perl 5 Select Highlighter: Scintilla
  2. Using File/Open? open the file t/files/no_strict.pl
  3. The status bar at the bottom should now show: the name of the file | Scintilla | Perl 5 | (and some more)
  4. In Tools/Preferences/Files? and Colors Select File Type: Perl 5 Select Highlighter: PPI Experimental
  5. Viewing the already open no_strict.pl file the status bar at the bottom should now show: the name of the file | PPI Experimental | Perl 5 | (and some more) The coloring of the code has changed.
  6. In Tools/Preferences/Files? and Colors Select File Type: Perl 5 Select Highlighter: PPI Standard
  7. Viewing the already open no_strict.pl file the status bar at the bottom should now show: the name of the file | PPI Standard | Perl 5 | (and some more)
Who Padre version system status
szabgab r13895 Ubuntu 10.10 OK

TODO

  • add screenshots with default highlighting of the various syntax highlighers
  • other programming languages
  • syntax highlighting (coloring):
    • HTML export #112
    • customizable
    • for many languages
Last modified 3 years ago Last modified on Jun 23, 2011, 9:40:54 AM