| 1 | package Padre::Plugin::Moose::Util; | ||
| 2 | |||
| 3 | use 5.008; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | our $VERSION = '0.21'; | ||
| 8 | |||
| 9 | sub add_moose_keywords_highlighting { | ||
| 10 | my $type = shift or return; | ||
| 11 | my $document = shift or return; | ||
| 12 | my $editor = shift or return; | ||
| 13 | |||
| 14 | my $keywords = Padre::Wx::Scintilla->keywords($document); | ||
| 15 | if ( Params::Util::_ARRAY($keywords) ) { | ||
| 16 | foreach my $i ( 0 .. $#$keywords ) { | ||
| 17 | my $keyword_list = $keywords->[$i]; | ||
| 18 | if ( $i == 0 ) { | ||
| 19 | $keyword_list | ||
| 20 | .= ' has with extends before around after' | ||
| 21 | . ' override super augment inner type subtype' | ||
| 22 | . ' enum class_type as where coerce via from' | ||
| 23 | . ' requires excludes'; | ||
| 24 | if ( $type eq 'MooseX::Declare' ) { | ||
| 25 | $keyword_list .= ' class role method dirty clean mutable'; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | $editor->Wx::Scintilla::TextCtrl::SetKeyWords( $i, $keyword_list ); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | return; | ||
| 33 | } |