New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab completion #391
Tab completion #391
Conversation
|
sounds like a good proof of concept, but not mergable yet (due to Linenoise.pm/linenoise deps), but still, good work! |
|
I should add that the REPL will still work without Linenoise.pm; tab completion just doesn't. |
|
|
||
| $!completions := nqp::hash(); | ||
|
|
||
| my $core_keys := self.eval('CORE::.keys'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care for this, but I don't know how else to get access to CORE.
|
I just merged |
|
This seems to fix it, though @hoelzro can you take a look at merging both @@ -215,7 +214,7 @@ class Perl6::Compiler is HLL::Compiler {
if $m {
my $word := $m<word>;
unless $word ~~ /^ "&" <.upper>+ $/ {
- sorted_set_insert($!completions, $word);
+ sorted_set_insert($!completions, $word) if $!completions;
}
}
} |
|
@FROGGS Thanks for looking at this; I'll fix this up right away! |
|
@FROGGS I merged the interactive methods and fixed up the code to be based on nom. |
This abstracts over readline libraries, if any are available
Its functionality is in NQP now
...instead of a hash. The advantage here is that we can offer a sorted list of completions, rather than providing them in seemingly random order.
|
It doesn't make sense unless we have a tab completion facility
Otherwise we get a warning
NQP bump brought: Raku/nqp@2017.12-63-gd93f6ed...2017.12-79-g4d3db7f00 4d3db7f00 [MoarVM Bump] Brings 25 commits 594dc7abf Fix number of skipped tests 98aedda0b Add a few tests that grammars match graphemes 3f1d425b3 [js] Make cclass in regexes match full graphemes ae09ff182 [js] Make enumcharlist match full graphemes 89aadbb00 [js] Make uniprop matching match full graphemes a45bfea40 Fix dumping block with null_s cuids 734b9e5e0 Add test descriptions 2f362439a Merge pull request #394 from tbrowder/pod-tests f64e981aa add new pod tests a76455f2c Merge pull request #391 from dwarring/cursor_init-tweak 3a9a497db remove unreachable code in cursor_init 92730bfef Add a few div_In tests 46cf36712 Fix typo in test description c266fcdaa [js] Fix nqp::div_In 0ed57f6f8 [js] Handle the DYN_COMP_WRAPPER hack on the js backend too
Do NOT merge me! I'm not ready yet!
This adds the linenoise changes from the
no-linenoisebranch (and thus depends on the corresponding NQP and MoarVM changes), in addition to some rudimentary tab completion.How rudimentary is it? Read on...
OUTER::OUTERfrom a Perl 6 script, because my Perl 6 introspection fu is weak. Ideally it should get its list from the REPL's context.linenoisedoesn't work out of the box on MoarVM, since MoarVM sets standard input to non-blocking. I used a patched version of linenoise to get around this, but Linenoise.pm should probably do something about that. Either that, or maybe MoarVM shouldn't set standard input to non-blocking; I don't know if that's a good idea or not.Perl6::Compilerotherwise, since the former is in Perl 6, and the latter is in NQP.Perl6::Compilerloads Linenoise.pm and gets symbols from it is atrocious.Listof completions.