I'm trying to implement a completion source to integrate ALE with Deoplete, and I can't quite get it to work properly. I'm wondering if you can give me some advice.
The last version of the code I wrote is available here: https://github.com/w0rp/ale/blob/d0f2a0ae940ef67649453de40c0ca3488d4dcec4/rplugin/python3/deoplete/sources/ale.py
For whatever reason, the completion source I wrote there caused the problems mentioned here: https://github.com/w0rp/ale/issues/2492 Because of that, I removed the completion source from ALE for now, until I can get it to work without causing those problems.
It seems like setting context['is_async'] = True and returning [] makes it so you can't accept completion results by pressing Enter any more, but it doesn't seem to happen all of the time. Is there anything wrong you can see in the code I wrote? I'd like to know if there's an easy way to fix it.
Thank you for your time.
I need to reproduce the problem.
Please create the minimal vimrc with the reproduce instructions.
Maybe @moritzheiber or @edgard can help.
Minimal config to reproduce with NVIM using Deoplete as completion engine together with ALE:
https://gist.github.com/edgard/8bb9c4d7596cc20a645f1f690c19007d
Please upload the reproduce instructions from starting like other issues.
I will try it later.
I'm not certain there is an issue. I just want to ask for guidance on how to write a completion source, as I couldn't get it to work, and I figured the person who implemented it would know best. If you do try @edgard's instructions, note that the completion source for ALE won't be loaded with the master version of ALE, as I have removed the Deoplete completion source for now.
I'm not certain there is an issue
I need to reproduce the problem to decide what is the problem.
It may be source problem or deoplete problem.
So my use case is the following, with the minimal config from comment:
1) Open any file on Neovim with "noinsert" completeopt on and Deoplete+ALE.
2) Start typing something, the pum will open up.
3) Don't select anything and press Enter.
Expected: no completion, close pum.
Result: it doesn't matter how many times Enter is pressed, the pum always come back and doesn't let you just press Enter to close pum and go to next line.
I'll see if I can create a dummy completion source that repeats the bug later.
I can create a completion source that demonstrates the issue. Create a completion source like so:
# This can be in a directory like so:
# ~/.vim/rplugin/python3/deoplete/sources/foobar.py
from deoplete.source.base import Base
class Source(Base):
def __init__(self, vim):
super(Source, self).__init__(vim)
self.name = 'foobar'
self.mark = '[L]'
self.rank = 100
self.is_bytepos = True
self.min_pattern_length = 1
def gather_candidates(self, context):
context['is_async'] = True
return []
Open a Vim file with the default Deoplete settings and run :call deoplete#enable(), and then type...
foo
It will be difficult to press Enter on the second line to create a third line, and you'll have to press Enter a few times to close the completion menu that pops up.
I'm wondering if you can offer advice on how to stop that from happening.
OK. I will test it later.
Reproduced. It is the bug of deoplete.
Please use the latest version.
Aha, thank you Shougo. :+1: I assumed I had done something wrong. I'll bring the completion source back into ALE later and let people know they can update Deoplete to fix the bug.
Awesome, thank you both for the awesome work! :)
Most helpful comment
Reproduced. It is the bug of deoplete.
Please use the latest version.