Comments (16)
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 job_start
which is incompatible with the one used in Neovim.
There is also vim-dispatch, which came along before both Neovim and job_start
in vim.
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?
from vim-force.com.
I'd love to enable asynchronous deployment, but presently there is no clear winner in async approaches for vim,
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. :)
from vim-force.com.
thank you for the examples, I'll give it a closer look at some point.
from vim-force.com.
@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.
from vim-force.com.
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
from vim-force.com.
Hello @ViViDboarder,
Thank you for the suggestion.
Have tried force-vim plugin just now (with Dispatch
installed) and let g:force_dispatch_background = 1
, but have not been able to see much visual feedback when running commands like :ForceTest
or :ForceDeploy
.
All I could see is last executed external command, e.g. !force test "Test1" (iterm/56905)
It also spawns a separate terminal window, which may not be to everyone's taste.
I am probably doing something wrong - do you have an example/video of running background job ?
When background mode enabled - is it possible to see a visual progress/feedback ?
Also, am I right assuming that neither Neomake nor Dispatch can be used in GUI mode, e.g. MacVim or gVim?
from vim-force.com.
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.
https://github.com/tpope/vim-dispatch#foreground-builds
from vim-force.com.
Thank you for the clarification.
In case of vim-force.com
plugin - Dispatch or Neomake (or any other async utility) can not be easily employed to enable async calls.
Main reason is that existing code base does a lot of stuff after call to sfdc has finished.
Before any async method is implemented all those logical parts (following SFDC call completion) have to be moved to callback methods.
Additionally (assuming existing plugin codebase has been updated with callbacks) there is a question of how to present feedback (messages) shown upon command completion.
For example :ApexPrintConflicts
may result in many messages with details. With current (synchronous method) vim does it for you automatically.
With any async method :messages
window has to be opened somehow, ideally from vim script. Unfortunately few tests I have done so far have shown that with current vim build calling something like :10message
from a callback method crashes vim most of the time. Hopefully this is just a temporary issue (since job_start/callbacks are a new thing), but it is a problem right now nevertheless.
from vim-force.com.
Hi guys,
I have had a go on implementing new vim async jobs support in vim-force.com
, but not quite ready to release it yet.
If you wan to try it out and give me your feedback please checkout branch vim-async and use tooling-force.com-0.3.6.2.jar.
vim-async
version requires server mode (see :help 'g:apex_server'
) and still has few (mostly visual) problems (e.g. when you run first command, and server starts, the way it is shown looks ugly).
Not all commands have been implemented in async mode, but the important ones like :ApexSave
, :ApexDeploy
, :ApexTest
are using async jobs.
There is no documentation yet, but the only new command you need to know is :ApexMessages
- it opens special buffer with log of all operations done in current session. In case of problems/errors it should open automatically, but if it does not, or you are not sure what is happening, make sure to call :ApexMessages
.
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: VIM - Vi IMproved 7.4, Included patches: 1-1831
from vim-force.com.
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.
let
vim-version = "7.4.1941";
in
{
packageOverrides = pkgs: rec {
vim = pkgs.vim.overrideDerivation (oldAttrs: {
name = "vim-${vim-version}";
src = pkgs.fetchFromGitHub {
owner = "vim";
repo = "vim";
rev = "v${vim-version}";
sha256 = "0apq7sv1fbyfzqh4q0r2z19bn4gbjlb97wyl80kj7qsqmsy7m1lm";
};
});
};
}
from vim-force.com.
@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?
from vim-force.com.
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.
Thanks.
from vim-force.com.
I'm using Vim 7.4.1941 in Terminal on Mac Yosemite 10.10.5.
When I have an async command running, then do q:
to get command history, I get the following error appearing the in command history window when the next async job status update appears. I'll look at getting a video soon.
Failed to identify resource name for file
Error detected while processing function 112[8]..apexMessages#log[1]..<SNR>86_logHeader[3]..<SNR>86_cacheLines[6]..<SNR>86_isVisible[1]..<SNR>86_getBufNumber[1]..<SNR>86_getBufferName[1]..apex#getApexProjectSrcPath[5]..apex#getSFDCPro
jectPathAndName:
line 24:
E605: Exception not caught: src folder not found
Error detected while processing function 112[8]..apexMessages#log[1]..<SNR>86_logHeader[3]..<SNR>86_cacheLines:
-- More --
from vim-force.com.
thank you for the details.
No need for video actually, I get the idea. Will try to reproduce it...
from vim-force.com.
Hello @chexxor,
The error you were experiencing was caused by a redundant piece of code which is now removed.
Please try again with latest version of vim-async
branch and let me know if the issue is still there.
from vim-force.com.
@neowit, I did some quick testing - the issue I described above with q:
command seems to be resolved. Works great!
from vim-force.com.
Related Issues (20)
- Cannot run scripts other than :ApexInitProject before running this script HOT 4
- [Question] Is it possible to check what org am I currently using? HOT 3
- [Question] Is it possible to know remote changes author? HOT 2
- Code Syntax Highlighting for files with extension `*.apxc`? HOT 1
- ApexRefreshProject do not download my new CustomSetting HOT 2
- can not run test for specific method HOT 2
- :ApexExecuteAnonymous: show some error for ~100 milliseconds HOT 3
- ApexTestWithCoverage open buffer with incorrect data HOT 3
- :ApexTest - is it possible to skip `Select Log Type to change`? HOT 1
- Auto-completion doesn't work HOT 7
- incorrect syntax highlight HOT 1
- Unable to refresh projects and files (Unexpected end-of-input) HOT 8
- Commands Fail Silently If Another Process Already Bound to Server Port HOT 3
- sfdx support HOT 1
- Unknown function HTMLIndent HOT 12
- Is there an option for force refresh of file. ApexRefreshFile doesn't support "!" like ApexDeploy! ? HOT 2
- Is ApexTListToggle deprecated? HOT 2
- ApexTestWithCoverage fails with below error. My Deploy/Refresh commands don't have any issues HOT 3
- Autocomplete is slow. HOT 2
- LWC support (in non-sfdx projects) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-force.com.