3 package Devel::REPL::Plugin::CompletionDriver::Keywords;
4 use Devel::REPL::Plugin;
5 use B::Keywords qw/@Functions @Barewords/;
6 use namespace::autoclean;
10 $self->load_plugin('Completion');
13 around complete => sub {
15 my ($self, $text, $document) = @_;
17 my $last = $self->last_ppi_element($document);
20 unless $last->isa('PPI::Token::Word');
22 # don't complete keywords on foo->method
24 if $last->sprevious_sibling
25 && $last->sprevious_sibling->isa('PPI::Token::Operator')
26 && $last->sprevious_sibling->content eq '->';
28 my $re = qr/^\Q$last/;
31 grep { $_ =~ $re } @Functions, @Barewords;
40 Devel::REPL::Plugin::CompletionDriver::Keywords - Complete Perl keywords and operators
44 Shawn M Moore, C<< <sartak at gmail dot com> >>