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

Completion improvements #16

Closed
4 tasks done
Olical opened this issue Apr 2, 2019 · 17 comments
Closed
4 tasks done

Completion improvements #16

Olical opened this issue Apr 2, 2019 · 17 comments
Assignees
Labels
enhancement New feature or request feedback Ideas up for discussian
Milestone

Comments

@Olical
Copy link
Owner

Olical commented Apr 2, 2019

Omnicompletion is released but here's some things that should be improved at some point:

  • Full async support through various plugins.
  • Select the first matching Clojure connection to find completions, not ClojureScript which isn't supported.
  • Provide context to compliment.
  • Fire my own copy of compliment over the prepl so users don't need to depend on it.
@Olical Olical added the enhancement New feature or request label Apr 2, 2019
@jlesquembre
Copy link
Contributor

Hi,
I quickly tested conjure completion and seems to work pretty well, good job!
I also was able to integrate conjure with coc.nvim:

PD: You just released 0.8, I was testing coc with 0.7, but I think it should continue working

@Olical Olical added the feedback Ideas up for discussian label Apr 4, 2019
@Olical
Copy link
Owner Author

Olical commented Apr 4, 2019

Oh wow! This is brilliant, I didn't think anyone would be able to get it working nicely with the omnifunc though, I wonder how that performs with many dependencies loaded. When I hooked deoplete into it I saw a lot of input lag. So my typing was really hindered by going off to a blocking function on every key press.

Is this actually asynchronous somehow? I'm just not sure how it could be, maybe it's blocking but "fast enough". My theory was that I'd need to expose some sort of async port in the Conjure JVM that tools such as deoplete and CoC could hook into and call without blocking the Neovim thread. Maybe that's over-engineering seeing this.

I'll give it a try, thank you very much!

For some reason, asciinema doesn't show properly my terminal after opening neovim.

Could just be your TERM environment variable or something, I vaguely recall having trouble with that in the past.

@Olical
Copy link
Owner Author

Olical commented Apr 4, 2019

It works really well 😍

I have no idea how it's so fast though, I thought it should be blocking the input 🤔

Olical/dotfiles@0f82df0

@Olical
Copy link
Owner Author

Olical commented Apr 4, 2019

Ah, if you're not connected to anything it'll spam "you have no matching connections" to the log as it tries to complete. I'll silence that I think.

@jlesquembre
Copy link
Contributor

It's not asynchronous. The call to conjure#omnicomplete, done by the plugin, blocks neovim. But it's fast enough, at least on my simple tests.
I want to find a way to make it asynchronous. I'm not sure, but as you mention, maybe Conjure needs to expose some async port to make it work.

@Olical
Copy link
Owner Author

Olical commented Apr 4, 2019

I wonder if an async + callback based system could be implemented, like you give it a Neovim funcref or something and it'll call that with the results when done 🤔 I'm going to change the current setup anyway so your autocomplete won't log out "no matching connections" but the manual omnicomplete will.

But yeah, I think async_completions with a callback of some kind could work really well in deoplete and CoC. I don't really want to have to manage essentially an async RPC server on the side if I can help it.

@Olical
Copy link
Owner Author

Olical commented Apr 10, 2019

Plan: Open up a port that lets you communicate with Conjure over msgpack RPC just like neovim does. So this is a side port that lets you give Conjure commands without having to go through neovim and block the process. You call a function to get the port.

Once you have that your async completion process can just ask Conjure (which is fully multi threaded any way) for completions. It will only block if there is currently an eval blocking the prepl on the other end, a timeout there is probably a good idea.

Another idea: I wonder if I could add compliment to Conjure's JVM then bridge the requests it makes for symbols and information over the network. Essentially making compliment work over the network 🤔 Or I'll fork it and pull out the bits I need to get it working over the network.

Olical added a commit that referenced this issue Apr 13, 2019
So it opens up on a random port and allows you to send and receive
msgpack RPC messages like Neovim does over stdio. Should support any
number of clients, will have to make it so that you can request the
port.

I don't think it'll work right now so I'll write a test client to check
things with next. #16
@Olical
Copy link
Owner Author

Olical commented Apr 14, 2019

@jlesquembre I've added a JSON RPC server to Conjure and I'm using it to add support for Deoplete here https://github.com/Olical/conjure/blob/master/rplugin/python3/deoplete/sources/conjure.py

You might want to make use of it too, it works really well for me! I won't release this as a tagged version just yet because I want to give it a go at work all week first. I ended up changing a lot so I need to make sure it still works fine without any completion tools installed etc.

@jlesquembre
Copy link
Contributor

Nice! I'll try to find some time tomorrow and update my CoC plugin

@jlesquembre
Copy link
Contributor

Done, updated it to use the RPC server

@Olical
Copy link
Owner Author

Olical commented Apr 15, 2019 via email

@jlesquembre
Copy link
Contributor

I'm realizing that my last message was too short.
I did some quick tests, and It worked perfectly, great job!
Right now I'm not making use of the RPC request id, just using always the same id. Need to think about how to handle it, or even if it's possible to manage them with CoC.
I didn't do a release of the plugin yet, waiting for the next conjure release.

One last thing, you wrote that sometimes completions were not trigger for you, I think that the reason is CoC timeout for completions, 2 seconds by default:

https://github.com/neoclide/coc.nvim/blob/303d95d2bbb1d0bed06f79ca399461ef5d115426/data/schema.json#L319-L325

and had nothing to do with the triggerCharacters option.

@Olical
Copy link
Owner Author

Olical commented Apr 16, 2019 via email

@Olical
Copy link
Owner Author

Olical commented Apr 16, 2019

Released under v0.10.0 https://github.com/Olical/conjure/releases/tag/v0.10.0

@jlesquembre Feel free to tag your release too 😄

@jlesquembre
Copy link
Contributor

@Olical nice, just created a new release

Olical added a commit that referenced this issue Apr 25, 2019
Surprisingly easy after all those upgrades to read-form!
@Olical
Copy link
Owner Author

Olical commented May 7, 2019

I've added a flag in the latest commit (not under a tag yet) that sets g:conjure_ready = 1 when the JVM is up and running. I encountered an issue where if I started typing before the JVM was up Deoplete could lock up Neovim for a second or so.

I now check for that flag before sending off for completions from my Deoplete plugin. Might come in handy for others in the future too. If you make a call before it's up then it'll block until it's ready, this just allows you to avoid making background calls that would lock up Neovim until everything's running.

Olical added a commit that referenced this issue May 7, 2019
@Olical
Copy link
Owner Author

Olical commented May 7, 2019

v0.13.0 will contain automatic injection of Compliment. You don't need to depend on it any more, it'll get loaded for you. When Compliment supports ClojureScript all you'll have to do is update Conjure and it'll just start working for you, neat 😄 🎉

@Olical Olical closed this as completed May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback Ideas up for discussian
Projects
None yet
Development

No branches or pull requests

2 participants