1 package Devel::REPL::Plugin::CompletionDriver::LexEnv;
2 use Devel::REPL::Plugin;
3 use namespace::autoclean;
7 $self->load_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::Symbol');
19 my ($sigil, $name) = split(//, $last, 2);
20 my $re = qr/^\Q$name/;
23 # ReadLine is weirdly inconsistent
24 map { $sigil eq '%' ? '%' . $_ : $_ }
26 map { substr($_, 1) } # drop lexical's sigil
27 '$_REPL', keys %{$self->lexical_environment->get_context('_')};
36 Devel::REPL::Plugin::CompletionDriver::LexEnv - Complete variable names in the REPL's lexical environment
40 Shawn M Moore, C<< <sartak at gmail dot com> >>