Skip to content

Commit

Permalink
Make completions unique
Browse files Browse the repository at this point in the history
  • Loading branch information
bduggan committed Feb 10, 2024
1 parent 0892c43 commit 54163f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Jupyter/Kernel/Sandbox/Autocomplete.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ method complete($str,$cursor-pos=$str.chars,$sandbox = Nil) {
my @methods = self!find-methods(:$sandbox, var => "$<invocant>", all => so $<method-call>);
my $meth = ~( $<method-call> // "" );
my $len = $p - $meth.chars;
return $len, $p, @methods.grep( { / ^ "$meth" / } ).sort;
return $len, $p, @methods.grep( { / ^ "$meth" / } ).sort.unique;
}
when / <invocant> <!after '.'> '.' <!before '.'> <how-call> $/ {
info "Completion: method how call";
my @methods = Metamodel::ClassHOW.^methods(:all).map({"^" ~ .name});
my $meth = ~( $<method-call> // "" );
return $p-$<how-call>.chars, $p, @methods.grep({ / ^ "{$<how-call>}" / }).sort;
return $p-$<how-call>.chars, $p, @methods.grep({ / ^ "{$<how-call>}" / }).sort.unique;
}
when / <import> \s* <modul>? $/ {
info "Completion: module import";
Expand Down

0 comments on commit 54163f4

Please sign in to comment.