CompletionDriver::Methods which currently only works on classnames
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / CompletionDriver / Keywords.pm
CommitLineData
1989c3d2 1package Devel::REPL::Plugin::CompletionDriver::Keywords;
2use Devel::REPL::Plugin;
3use B::Keywords qw/@Functions @Barewords/;
4use namespace::clean -except => [ 'meta' ];
5
6around complete => sub {
7 my $orig = shift;
8 my ($self, $text, $document) = @_;
9
8051a5e0 10 my $last = $self->last_ppi_element($document);
1989c3d2 11
12 return $orig->(@_)
13 unless $last->isa('PPI::Token::Word');
14
15 my $re = qr/^\Q$last/;
16
17 return $orig->(@_),
18 grep { $_ =~ $re } @Functions, @Barewords;
19};
20
211;
22