-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Parallel installer for Neovim #103
Conversation
- Abort running jobs when plug windows is reset - Multi-line error report - Retain window view
🌋 🎅 🌋 !!!111 I'm going to test the hell out of this :)
This is a great point. We will definitely consider this use case.
Will also add a Neovim issue for this, or if you want to, please feel free.
This is planned.
Not yet, we need to (1) finish transitioning all OS-specfic code to libuv, and (2) migrate the integration tests. |
Just gave it a whirl, updated 62 plugins in 11 seconds. cc @tarruda |
@justinmk Thanks for checking out. While asynchronous installer makes things a bit complex, like making sure that you're on the right buffer whenever you try to update the screen, I think I like the responsiveness of it. Well, job control is not a good fit for synchronous fork/join model anyway. As for the case of Maybe this is also planned, but I wish I could pass the name of the jobs directly to I wonder when would be the right time to really merge this to master. Is the job control API stable? I'd like to know if it's going to be backward-compatible. |
I remember thinking that too, we should definitely add that.
There might be a few breaking changes but I wouldn't let that hold it back from master. Neovim users expect things to break, and I will be a daily user of this plugin so I'll be happy to send a PR (any potential breaking changes to job control are not likely to require any major logic changes--just some arity or syntax tweaks). edit:
This is a great example of why buffers need to be easier to work with. neovim/neovim#901 |
Time to refactor my vimrc to use this, great work! |
BTW, it will probably be easy to add a |
Thanks. The only missing feature that seemed relevant was error detection, but I managed to find a simple, albeit naive, workaround for it. @tarruda Thanks! |
@tarruda Will JobActivity handlers run while the execution is blocked on |
Yes, callbacks will run normally and you will be able to trigger window redraws(Just user interaction would be blocked). Though as I said, I still need to think about the |
@tarruda I see, that would be great. Maybe this should be filed as an issue on Neovim repo, but one thing I noticed while testing this async installer is that multi-key command sequences are interrupted by JobActivity event. For example if I run this code, call jobstart('loop', 'bash', ['-c', 'while [ 1 ]; do echo .; sleep 0.01; done']) even without any handler attached, I can't execute multi-key commands such as |
Parallel installer for Neovim
This is probably because Nvim uses a special key(K_EVENT) code to notify the main loop of asynchronous events, this might be getting in the way of multi-key commands. I will look for a fix |
@junegunn Probably you already know, but normally
There's movement on this here: neovim/neovim#1844 |
@justinmk I see but the argument to jobstart can be quite lengthy (chained commands), so it was easier for me to just use Thanks for the update! |
Instead of passing |
@benekastah In general, I assume by Windows support you mean cmd.exe the default shell. In that case, no such animal. To start on Windows they use the very logical You can see the flags at > http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true On a related note, I may help with testing Windows support soonish, but for now working on my python fork. EDIT: Further related note, if your looking for cmd.exe support you might wanna browse the Vundle src as it worked fairly well on Windows. Including suppressing shell popups I believe. |
Passing the arguments as a list to jobstart avoids shell escaping problems, and will avoid cmd.exe completely on windows. |
This pull request implements parallel installer using Neovim's job control.
(/cc @justinmk)
Caveats
Asynchronous
Due to the nature (or limitation?) of job control, this version of parallel installer is asynchronous. (Polling doesn't work since it blocks main thread.) You can freely move your cursor, edit other buffers while installation is ongoing. Which is cool and all but it's inconsistent with the current behavior, and it's not anymore possible to write something like the following:
# The installer is asynchronous, so this will exit immediately nvim +PlugUpdate +qa
Being asynchronous also means that the user can close the plug window or switch tabs anytime during the installation. If the window is closed, we have to make sure that the running jobs are correctly terminated. Currently I'm calling
jobstop()
function to abort tasks, but I've noticed that the git processes are not immediately killed.So we definitely need more tests but unfortunately I don't think it's possible to write test cases for asynchronous behavior using Vader.vim.
Unable to detect errorsAs far as I know, the current API of job control does not expose the exit status of the process.
EDIT: Implemented with a workaround
Task timeout not implemented
I didn't bother to implement task timeout.
Windows support
I don't think
jobstart(name, 'sh', ['-c', args])
would run on Windows. 😒Does Neovim support Windows?