1 package Devel::REPL::Plugin::CompletionDriver::Keywords;
2 use Devel::REPL::Plugin;
3 use B::Keywords qw/@Functions @Barewords/;
4 use namespace::clean -except => [ 'meta' ];
7 Devel::REPL::Plugin::Completion
10 around complete => sub {
12 my ($self, $text, $document) = @_;
14 my $last = $self->last_ppi_element($document);
17 unless $last->isa('PPI::Token::Word');
19 # don't complete keywords on foo->method
21 if $last->sprevious_sibling
22 && $last->sprevious_sibling->isa('PPI::Token::Operator')
23 && $last->sprevious_sibling->content eq '->';
25 my $re = qr/^\Q$last/;
28 grep { $_ =~ $re } @Functions, @Barewords;
37 Devel::REPL::Plugin::CompletionDriver::Keywords - Complete Perl keywords and operators
41 Shawn M Moore, C<< <sartak at gmail dot com> >>