-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
is_async
logic may be broken after changes in Parallel branch
#636
Comments
Please upload the example what I can test. And the reproduce instructions are needed. |
Sample async Source: from .base import Base
import re
RT_PATTERN = r'RT:?\w*$'
RX_RT = re.compile(RT_PATTERN, re.IGNORECASE)
def log(msg):
with open('/tmp/async.log', 'a') as file_:
file_.write('%s\n' % msg)
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.debug_enabled = True
self.name = 'request_tracker'
self.mark = '[RT]'
self.is_volatile = True
self.matchers = []
self.sorters = []
self.max_menu_width = 120
self.max_abbr_width = 120
self.input_pattern = RT_PATTERN
self._cached_input = None
self._counter = 10
def get_complete_position(self, context):
match = RX_RT.search(context['input'])
return match.start() if match else -1
def gather_candidates(self, context):
if context['input'] != self._cached_input:
log('RESET INPUT')
self._cached_input = context['input']
self._counter = 10
if self._counter == 0:
log('RESULT READY')
context['is_async'] = False
return ['RTfirst', 'RTsecond', 'RTthird']
self._counter -= 1
log('RESULT IS NOT READY: counter %s' % self._counter)
context['is_async'] = True
return [] Reproduce: start nvim and type I get these messages in /tmp/async.log on commit 865747e:
Here are the messages in the current master:
|
Please test the patch. I think it fixes the problem. |
Unfortunately, it doesn't.
Looks like a kind of a race condition, because sometimes counter goes down to 4, if I type more characters, e.g. |
Unfortunately, I cannot reproduce the problem with the patch. |
The completion will be skipped if you changed input. |
If so, it depends on your environment. I cannot reproduce/fix the problem. Of course, if it is reproduced for me, it can be fixed easily. |
Could you please try this repo to reproduce the issue locally? https://github.com/balta2ar/deoplete-async
After that in nvim type "RT" only. I can reproduce the issue in this environment. This isn't exactly a minimal setup, but at least you could reproduce it yourself, then we can think how to minimize it. I couldn't point out a single plugin that's breaking things, I think it could be a collection of plugins. |
In the repo example I forgot to apply the patch you mentioned... As you say, it may be crucial. I'll try to do that tomorrow, or if you get to this sooner than me, please do it yourself. |
I have merged the patch in the master. |
I confirm that the issue is gone for now both on my actual machine and in the docker env. As it sometimes happen with race conditions, may it be because of "timeout clearance" is higher now (i.e. it's just chances for that to happen are lower but they are still there)? For my edification, could you please explain why that patch helps and what it does, @Shougo? It's vimscript, I'd never even thought to go there if I were to track it down, I'd be checking python code only. |
Because, the async completion is skipped if previous candidates are same. |
As discussed in #602 (comment), it may be the case that
is_async
logic has changed after Parallel branch was implemented. My plugin is rather a cumbersome piece of unstructured code, so if you won't be able to reproduce the issue yourself, I'll try to tidy it up and come with an example.Quoting the comment:
The text was updated successfully, but these errors were encountered: