Skip to content

Please add more doc: asynchronous completion #518

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

Closed
gpotter2 opened this issue Jun 30, 2017 · 3 comments
Closed

Please add more doc: asynchronous completion #518

gpotter2 opened this issue Jun 30, 2017 · 3 comments

Comments

@gpotter2
Copy link
Contributor

gpotter2 commented Jun 30, 2017

Hello,
I'm currently replacing our pyreadline auto completion by the one of prompt-toolkit.
(secdev/scapy#703)

In our implementation, we encapsulate the code.interact function, which acts like a python shell, in which we use the prompt function.

Auto completion is working great, but is slow. There's some obscure functions in the doc: http://python-prompt-toolkit.readthedocs.io/en/stable/pages/reference.html#prompt_toolkit.buffer.Buffer.start_completion, which made me feel that this could be speed-up... am I right ?

If so i got several questions:

  • What is the Future class that all doc talks about ?!
  • It's written here that it's located in prompt_toolkit.eventloop.future.Future, which does not seem to exist...
  • How do we implement asynchronous completion ? There are no examples for that :/

The project's great ! Great work

Thanks !

@jonathanslenders
Copy link
Member

This is weird. It looks like readthedocs took the documentation of the 2.0 branch.
2.0 got both asynchronous+synchronous autocompletion, auto suggestion and input validation.

For the 1.0 version (master branch), autocompletion is always asynchronous (running in a background thread), unless readline-style completions are used (press Tab to trigger completion).

Currently, there is nothing special you have to do to get asynchronous autocompletion. Just pass the Completer instance. Know that Completer.get_completions is called in a background thread, and the completions are displayed when that function call finishes.

@jonathanslenders
Copy link
Member

By the way, thanks for pointing this out!
Check the documentation here: http://python-prompt-toolkit.readthedocs.io/en/master/
Let me know if you have some questions. When 2.0 is ready, it will have much more documentation (give it maybe half a year).

@gpotter2
Copy link
Contributor Author

gpotter2 commented Jul 1, 2017

Ok thanks for the info ! My only next question is about #519.

@gpotter2 gpotter2 closed this as completed Jul 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants