-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
[RFC] Fix #471 Parallel #602
Conversation
536ef98
to
8995d3a
Compare
The current status is:
|
I will fix the problem later. |
@roxma I have added the threading feature. |
attach vim in another thread seems does not work. |
I have updated it. |
I have implemented the feature. |
The more testers and the code reviewers are needed. |
I can help to test on vim in case :-) What is the way to get that branch with vundle? |
any configuration needed to make it to work? i'm on linux and it didn't work when i switched the branch |
Vundle does not support branch swich.
No additional configuration is needed. |
@Shougo yes, it works after i wait for a few seconds, do you need to test some specific things? |
Nothing. It works. But it is very experimental. I'm waiting for neovim/pynvim#294. |
I will change the implementation using msgpack instead of Vim variables. |
I have completed the development. @blueyed Profile and debug feature tests are needed. |
I will add the error check later. |
@Shougo Sorry, I checked the vimrc, the
After set the |
I don't know why it does not work. Note: You have seen the |
You're using msgpack here. What's the reasoning for this choice? Could it be JSON or Pickle instead? I'm not questioning the choice, it's just good for my own knowledge to know which one to pick in which situation. |
It is good question.
|
wait to kill python processes.
Merged. |
Unfortunately, it broke my deoplete plugin...
|
@balta2ar I cannot reproduce the problem.
What is the plugin? |
It looks like I found the problem in my code: I had several But there is still a problem. My plugin relies on the |
If you can implement the feature, should be.
Hm. I will check the behavior later. |
To support using |
Or maybe just |
OK. I will test that. |
diff --git a/rplugin/python3/deoplete/child.py b/rplugin/python3/deoplete/child.py
index 1e14e09..464e1fd 100644
--- a/rplugin/python3/deoplete/child.py
+++ b/rplugin/python3/deoplete/child.py
@@ -79,10 +79,13 @@ class Child(logger.LoggingMixin):
self._on_event(args[0])
elif name == 'merge_results':
self._write(self._merge_results(args[0], queue_id))
+ self.debug('main_loop: end')
def _write(self, expr):
- sys.stdout.buffer.write(self._packer.pack(expr))
- sys.stdout.flush()
+ # sys.stdout.buffer.write(self._packer.pack(expr))
+ # sys.stdout.flush()
+ sys.stderr.buffer.write(self._packer.pack(expr))
+ sys.stderr.flush()
def _enable_logging(self):
logging = self._vim.vars['deoplete#_logging']
@@ -141,6 +144,7 @@ class Child(logger.LoggingMixin):
self.debug('Loaded Filter: %s (%s)', f.name, path)
def _merge_results(self, context, queue_id):
+ self.debug('merged_results: begin')
results = self._gather_results(context)
merged_results = []
@@ -162,6 +166,7 @@ class Child(logger.LoggingMixin):
is_async = len([x for x in results if x['context']['is_async']]) > 0
+ self.debug('merged_results: end')
return {
'queue_id': queue_id,
'is_async': is_async,
diff --git a/rplugin/python3/deoplete/dp_main.py b/rplugin/python3/deoplete/dp_main.py
index 04e0448..dff1e84 100644
--- a/rplugin/python3/deoplete/dp_main.py
+++ b/rplugin/python3/deoplete/dp_main.py
@@ -5,6 +5,7 @@
# ============================================================================
import sys
+import io
from neovim import attach
@@ -28,10 +29,21 @@ def attach_vim(serveraddr):
return vim
+class RedirectStream(io.IOBase):
+ def __init__(self, redirect_handler):
+ self.redirect_handler = redirect_handler
+
+ def write(self, data):
+ self.redirect_handler(data)
+
+ def writelines(self, seq):
+ self.redirect_handler('\n'.join(seq))
+
def main(serveraddr):
vim = attach_vim(serveraddr)
from deoplete.child import Child
from deoplete.util import error_tb
+ sys.stdout = RedirectStream(lambda data: vim.out_write(data))
try:
child = Child(vim)
child.main()
diff --git a/rplugin/python3/deoplete/process.py b/rplugin/python3/deoplete/process.py
index d1ac7b3..e81ca35 100644
--- a/rplugin/python3/deoplete/process.py
+++ b/rplugin/python3/deoplete/process.py
@@ -52,7 +52,11 @@ class Process(object):
def enqueue_output(self):
while self._proc:
- b = self._proc.stdout.read(1)
+ # b = self._proc.stdout.raw.read(102400)
+ b = self._proc.stderr.raw.read(102400)
+ if b == b'':
+ return
+
self._unpacker.feed(b)
for child_out in self._unpacker:
self._queue_out.put(child_out) Hm. It may be better. |
@bfredl I cannot use stderr because of SpaceVim/SpaceVim#1397 |
@balta2ar I have fixed stdout problem completely. |
Why are you sending the msgpack over stderr? That will indeed cause all sorts of trouble... Instead, use the original stdout stream:
|
Yes. I have fixed it in the latest version. |
It is on WIP.Note: profile and debug feature is not supported.You can test the feature!