Skip to content
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

feat(cli/repl): use completion candidate as hint #8126

Closed

Conversation

caspervonb
Copy link
Contributor

This shows the first completion candidate as a hint, which is rendered as gray text to the right of the cursor.

This shows the first completion candidate as a hint, which is rendered
as gray text to the right of the cursor.
@caspervonb
Copy link
Contributor Author

caspervonb commented Oct 26, 2020

Example output

Screenshot 2020-10-26 at 10 12 30 AM

@caspervonb caspervonb marked this pull request as ready for review October 26, 2020 04:54
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, needs a test case, we'll land it for 1.6.0

@bartlomieju bartlomieju added this to the 1.6.0 milestone Oct 26, 2020
Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the concept, but there is one major issue. There is a significant lag when typing or removing characters. We seem to be blocking until we get the hint from V8. We should be acquiring the hint asynchronously, and not blocking on that.

Also it would be nice if you could use the up and down keys to navigate through the hints before pressing tab. That is not strictly required for this PR to land though.

@caspervonb
Copy link
Contributor Author

I like the concept, but there is one major issue. There is a significant lag when typing or removing characters. We seem to be blocking until we get the hint from V8. We should be acquiring the hint asynchronously, and not blocking on that.

Ugh assumed the lag was my ssh connection but compared to bash on the same server indeed it is slow.
Unfortunately the entire rustyline interface is synchronous and callback based so hints have to block until resolved. There's no way to push the current hint at this time 😟

Most likely won't end up landing this due to the input lag, but I'll see what can be done.

Also it would be nice if you could use the up and down keys to navigate through the hints before pressing tab. That is not strictly required for this PR to land though.

Don't think this is something the rustyline editor is currently capable of (all the interesting bits are private), but can look into it.

@bartlomieju bartlomieju removed this from the 1.6.0 milestone Nov 21, 2020
@bartlomieju
Copy link
Member

@caspervonb seems we can't do much about it until kkawakam/rustyline#126 is resolved. I'm going to provisionally close this PR, let's discuss alternate approaches on Discord.

@caspervonb
Copy link
Contributor Author

Yup, this introduces too much latency at the moment.

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

Successfully merging this pull request may close these issues.

3 participants