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
Integration with deoplete #1753
Comments
Hack: diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 7440f8cd..55694d8d 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -1,6 +1,10 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Completion support for LSP linters
+if exists('g:loaded_deoplete')
+ finish
+endif
+
" The omnicompletion menu is shown through a special Plug mapping which is
" only valid in Insert mode. This way, feedkeys() won't send these keys if you
" quit Insert mode quickly enough. |
In addition, there is no buffer ( |
I don't have the time to implement integration with deoplete myself, and I don't use it myself. If someone wants to submit a pull request for deoplete integration with some sensible code, I'll be happy to get that in. I'll add support for a buffer variable for disabling completion for different buffers. |
What completion do you use then? |
I just use the completion I wrote for ALE. |
For anyone also interested, I'm working on this. You can see in the example below that it works pretty well but it's not quite as good yet. The [L] symbol represents completion from ALE's omnifunction. It's shown how it comes together asynchronously with the other sources. It does not reliably proc near the dot at the moment. Also it required decoupling and refactoring the design of completion.vim on my end so I've got to make sure the current way still works for people, and suits users looking to extend the exposed functionality. I think I can open the PR proposal soon. To be clear @w0rp the integration is done through an external source and deoplete integration won't be embedded into ALE. The changes I made were to decouple the completion engine from the Autocmd actions and then expose the functions for usage outside of ALE. |
Sure, throw up a PR when you can do so people can look at it. Thanks for working on it. 👍 |
With the release of v2.4, how close are we to it being possible to integrate with external plugins like deoplete? I love ale and use it for my linting/fixing needs, but I also use deoplete to integrate non-LSP completion such as connecting my addressbook to mutt via lbdbq. It's a bit of a battle to get things working split between them. It looks like the owner of #2143 abandoned the effort. @w0rp, what is your stance on this? Is this on a roadmap given the good progress you've made leading up to v2.4, especially after adding support to manually invoke completion? |
Came here to ask the same thing. |
Deoplete has it's own system of pattern matching to trigger a completion. ALE had it's own rules and custom regexes. Omnicompletion happens in two steps
the first thing I did was put them in two separate functions so that deoplete could call them from the outside. but since step 2 is asynchronous, the caller needs to know when results are ready. I made a callback in the global namespace which anyone, include Vimscript users who don't use other plugins, could use to filter the results before they are displayed. I was unaware that w0rp prefers to do it like this
instead of my suggested approach
This alone generated unneeded noise/discussion and could have been solved trivially as I was willing to do whatever way and didn't find this relevant. The rest of the thread just didn't go anywhere because I was trying to explain that you can't "call to deoplete". Setting variables from VimL, so that Deoplete can read with an eval and decide what to do, is effectively the way to retrieve results. There's no way to pause the loop once it starts querying the source, so ALE has to employ some mechanism to handle calls coming every 20~milliseconds from Deoplete and return some variable in response. What I was doing with PollCompletionResults is returning an empty array until there are actual results to show, but it can't be just that
I've found so far that polling with a counting mechanism on the Deoplete's side for handling timeouts + cached fallbacks is good enough; of course reading and writing to a global variable or returning from a (fast!) function so that the candidates can be shown as fast as possible. |
Now #2132 is done, finishing Deoplete integration is my top priority. Although I'll still have to spend some time fixing bugs and merging pull requests as ever. |
I have now added integration with Deoplete which at least works to some degree. Please try it out, and open further issues for improvements. I was able to get it to the point where it can ask ALE if the requests are complete and then later return the results when they are, and where refreshing the results asks ALE to request results again. It works with my usual TypeScript project, so that's a good enough place to start. Thanks to @reaysawa for the initial effort on this. The information provided was very useful. |
@w0rp Just an FYI: Edit: I'd also suggest setting the |
Sure, feel free to create pull requests for those changes. I'm not aware of what to use instead of |
Hi @dsifford. Do you know what the correct way to register ale as a completion source is now? I've been trying to use |
I think it's supposed to be like this:
But I couldn't get it working either. |
Feel free to create a pull request to update the documentation to suggest whatever is now recommended for Deoplete. |
Can't get it to trigger for me, whereas toggling ALE's completion works fine. I'm assuming I've got something wonky in my configuration, so I'll need to set up a minimal vimrc to figure out what yields a working state. |
@chipsenkbeil I should also note that it's important to have |
OH ... I think I did a mistake, I had For anyone else, make sure that you don't have
|
I just updated the documentation to make it painfully obvious that you shouldn't turn that setting on if you want to use Deoplete or another completion plugin with ALE as a completion source. You shoudn't be able to read about that setting anywhere in the documentation without it telling you not to turn it on if you want that. |
I'm reopening this. I removed all of the code for supporting Deoplete for now because it caused this bug: #2492 Support can be added back in after it works without causing annoying problems for people. If anyone has any idea how to get it to actually work, please give it a try. I can't figure out how it's supposed to work, and as far as I can tell I did everything the documentation told me to do. I'll ask Shougo if he has any ideas. |
Shougo/deoplete.nvim#976 I asked for some advice. |
@w0rp have you given this a look yet for ideas? Seems like that and ALE would be extremely similar applications. |
For the record, I also have |
I don't know why it didn't work properly. It looked like the code I wrote was doing everything the documentation said I should do. Maybe someone else can take a look. |
Is there any possibility that the issues that were arisen were due to a faulty keymapping, and not the implementation? I didn't have any issues just before the ale source was removed. Keymapping the popup menu is notoriously tricky, so it doesn't seem like that possibility would be too far of a stretch. |
I'm concerned that the completion source being present was causing an issue for some people, and taking it away fixed it. It would be nice for it to just work. |
Okay, I've brought the completion source back now. It turned out that the issue was actually a bug in Deoplete, which has been fixed now. If you see that issue again, update Deoplete and it should go away: Shougo/deoplete.nvim#976 (comment) |
At the moment, deoplete and ALE's completion fight and cause weirdness.
I can make them play better together by putting
finish
at the top ofautoload/ale/completion.vim
to prevent any ALE completion loading.However, I'd prefer if they just played well together.
This was mentioned as an item for the 2.0.0 roadmap...
The text was updated successfully, but these errors were encountered: