-
Notifications
You must be signed in to change notification settings - Fork 25
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
Deploy in background via child process? (Neovim feature) #62
Comments
Yes, I did consider asynchronous mode in the past. The problem is that there is no standard way of doing this with vim. Neovim, as you mentioned, has one sort of job control, Vim (as of recently) has I'd love to enable asynchronous deployment, but presently there is no clear winner in async approaches for vim, so if we pick any of the above methods it would be available only to a small minority of vim users. Ideal scenario would be if vim & neovim were to standardise their async API. Do you have experience with any of those async methods? |
After reading the Channel & job design thread thread on their vim-dev group, I see what you mean. Vim is currently working on adding async tools, but Bram and Thiago, the Vim and Neovim project leaders, haven't agreed on the basic structure of async (e.g. channels & callbacks). I don't have have much experience with async methods, no. I searched for how some Neovim plugins which use Neovim's job_control are written. fasd.vim wraps job_start: if has('nvim')
call jobstart(cmd)
elseif has('job')
call job_start(cmd)
else
call system(join(cmd, ' '))
endif And redismru.vim wraps is in a similar way let start = has('nvim') ? 'jobstart' : 'job_start'
execute 'call '.start.'(a:cmd, opts)' vim-force.com already has a relatively complicated command runner to add support for Windows via Python and vimproc, so it seems ok to add another small conditional to support Neovim. :) |
thank you for the examples, I'll give it a closer look at some point. |
@neowit, if you don't need background deploy, then you shouldn't spend too much time on it. I wanted your quick opinion on it because I want to test background processing in vim. I'm just figuring the price we'd have to pay to get it. I plan to move forward with adding support for Neovim's background jobs (but not sure how soon, as I'm pretty slow). I'll update this thread if I make any discoveries. |
In my plugin I wrote an implementation that leverages Neomake, Dispatch or just blocking commands in Vim. An ideal solution would be to use jobs directly, but this provides a super quick way to drop in support without worrying about how each API works. https://github.com/ViViDboarder/force-vim/blob/master/plugin/ForceCli.vim#L71 |
Hello @ViViDboarder, Thank you for the suggestion. Have tried force-vim plugin just now (with I am probably doing something wrong - do you have an example/video of running background job ? Also, am I right assuming that neither Neomake nor Dispatch can be used in GUI mode, e.g. MacVim or gVim? |
That behavior is part of Dispatch. Dispatch offers a few ways to spawn the background command. I typically use tmux to do it. You actually want foreground mode and tmux if you want to see it. Then it will auto create a split with it running. |
Thank you for the clarification. In case of Additionally (assuming existing plugin codebase has been updated with callbacks) there is a question of how to present feedback (messages) shown upon command completion. |
Hi guys, I have had a go on implementing new vim async jobs support in
There is no documentation yet, but the only new command you need to know is IMPORTANT: you must be on the latest vim version. Especially if you use MacVim. Up until very recently there were some problems with jobs implementation. Here is the version I know works: |
I only tried :ApexDeployOne command for now, and it was successful. @neowit, this is a really awesome user experience. I'll keep using it to see if I encounter any problems. I use Nix to install tools like Vim. I had to manually bump the vim version from 7.4.1585 to 7.4.1941 to get the commands in the vim-async branch to work. Here's the ~/.nixpkgs/config.nix file I used to do that, if others need to do same.
|
@neowit, I wonder if you've also noticed this: When I start an async command, like ApexDeployOne, I hit a key to return to the buffer I was using and continue to watch the deploy updates in the status bar. If I change focus to a non-Apex syntax buffer, like the command history, then I see error messages appearing in the status bar. They don't affect the status of deployment, however, so I don't mind too much. Any idea where to look to debug this? |
Hello @chexxor, No, this is not something I have observed, but that is probably just because of insufficient amount of testing. Can you give a step-by-step scenario how to reproduce this ? Also, which vim do you use? Console or one of GUI variants? What version? If you could record a video/gif of the issue that would be even better. |
I'm using Vim 7.4.1941 in Terminal on Mac Yosemite 10.10.5.
|
thank you for the details. |
Hello @chexxor, The error you were experiencing was caused by a redundant piece of code which is now removed. |
@neowit, I did some quick testing - the issue I described above with |
Currently all vim-force.com commands block the UI. I'd like to be able to continue looking at code while a deploy is executing, as deploys can take >1 min.
Neovim has a job-control thing which enables a plugin to spawn a background process. I recall seeing a plugin which wraps this in a backward compatible way.
Have you thought about running these vim-force.com commands asynchronously?
The text was updated successfully, but these errors were encountered: