Commit | Line | Data |
1989c3d2 |
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' ]; |
5 | |
6 | around 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 | |
21 | 1; |
22 | |