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

Async completion at point #42

Open
bbuccianti opened this issue Oct 11, 2022 · 5 comments
Open

Async completion at point #42

bbuccianti opened this issue Oct 11, 2022 · 5 comments

Comments

@bbuccianti
Copy link
Contributor

First thank you @sanel for everything that you did with Monroe. Is the best package that I have installed on my emacs.

Regarding the completion, I feel like we can improve the last addition. Right now, I figured out that in order to use the nrepl protocol for getting the candidates words we needed to use a sync request. Because when the callback it's returning those candidates we are in the connection buffer.

I feel that there is a way to avoid this situation but I'm still thinking and can't find one. Cider does it too, but send to me that getting async would be better.

Can you help me to think about this issue?

@technomancy please I want to know what you think about it too.

Thank you very much.

@technomancy
Copy link
Contributor

Unfortunately as far as I can tell, async completion is only available in company.el, that is, a 3rd-party library. I don't know of any way to do this correctly without adding a dependency. =(

It's been a while since I looked into it tho; it's possible things have improved since then.

@bbuccianti
Copy link
Contributor Author

bbuccianti commented Oct 11, 2022 via email

@sanel
Copy link
Owner

sanel commented Oct 11, 2022 via email

@bbuccianti
Copy link
Contributor Author

bbuccianti commented Oct 11, 2022 via email

@technomancy
Copy link
Contributor

I feel that we can send in the message on which buffer completion at point it's getting called. And then, in the callback function, switch to that buffer in order to show the candidates.

It makes sense, but in order to do this you have to basically reinvent your own completion command from scratch. It would be better to provide a source of completion data that can be used by an existing completion command. That's how completion-at-point works; you provide it with a function which can give you completion candidates, but only synchronously. If you give it an async function, the completion command will already have returned by the time the result is ready.

On the other hand, company can be provided with a completion-source function which works asynchronously. But it's not built-in to Emacs. So there's a trade-off.

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

3 participants