Avoid completing keywords on $foo-> ...
Sartak [Sun, 25 May 2008 20:50:57 +0000 (20:50 +0000)]
git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@4405 bd8105ee-0ff8-0310-8827-fb3f25b6796d

lib/Devel/REPL/Plugin/CompletionDriver/Keywords.pm

index 55d5240..a897eca 100644 (file)
@@ -12,6 +12,12 @@ around complete => sub {
   return $orig->(@_)
     unless $last->isa('PPI::Token::Word');
 
+  # don't complete keywords on foo->method
+  return $orig->(@_)
+    if $last->sprevious_sibling
+    && $last->sprevious_sibling->isa('PPI::Token::Operator')
+    && $last->sprevious_sibling->content eq '->';
+
   my $re = qr/^\Q$last/;
 
   return $orig->(@_),