-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Added custom callback for compile_command #48
base: master
Are you sure you want to change the base?
Conversation
Is there any particular reason why this PR got ignored? As far as I can see, it's well within the "spirit" of vim-dispatch. |
It's been sitting in my rather daunting backlog. My concern is that background jobs don't fire a finish event on all adapters (particularly screen and tmux), so we'd be exposing an unreliable API. |
Can't argue with a backlog! That's a fair concern, this sort of async emulation is a pretty leaky abstraction, and will probably always be unless vim itself is patched. I'd argue though that an unreliable API is better than no API at all, especially given how many other projects implement their own half-working callback functionality, which is equally unreliable, if not more. It'd be nice to at least have a standard as-good-as-we-can-get async-with-callback API -- and if vim ever gets an async patch, you can just transparently add it as an adapter and other plugins would benefit. As an aside, this should work with tmux, since it patches the |
It will only work on tmux if |
Don't you mean autocmd VimResized * if !has('gui_running') | call dispatch#tmux#poll() | endif I might be misunderstanding the code of course. |
If the gui is not running, that piece of code fires, and that piece of code is contingent on a resize event. Foreground tasks kick off a resize event on termination because they run in a split pane, but background tasks don't, because they run in a different tmux window. |
Ok, I'm still not clear on why this means that there's a difference between Linux and Mac, but it doesn't matter. My point (unreliable callback > no callback) still stands. Perhaps a |
And that's where we disagree, as I feel broken is worse than nothing at all. But I'm willing to experiment after cutting a release next week. Can you start by clarifying how precisely you see LaTeX-Box working with dispatch.vim in the mix? In particular, why are you turning your nose up at a foreground dispatch? |
For me this is no longer an issue, since I use my own for of LaTeX-Box (vim-latex), which uses background and continuous compilation with If I were to use vim-dispatch for my own plugin (or for LaTeX-Box), then I could use any general method to compile my LaTeX document, including Makefiles, |
"Foreground" dispatch only blocks for adapters where a reliable callback isn't available (i.e., there's no vim server, and we can't use the tmux resize trick.) |
Then I am probably doing it wrong. I tested now with a very simple makefile. When I use |
If you're on Linux, in the gui, without an associated screen or tmux session, then yeah, there's no supported foreground dispatch configuration. But if you don't care about seeing the output, I think just rolling your own headless stuff as you've done is probably the way to go. |
And that does highlight the actual problem: you'd rather sacrifice output visibility than asynchronicity in that particular setup. Which doesn't really conflict with any of my goals. |
Yes, I'm on Linux and use the gui vim with no associated screen or tmux session. And yes, you are right with identifying the problem: I don't care about output visibility, but asynchronicity is important. In any case, my own headless approach works very well IMHO. So for me, this case is closed. However, I realize that vim-dispatch may be very useful for some other projects. I really like the coupling with tmux! |
I have the same arguments as @lervag, that compilation takes time and that I'd be willing to sacrifice callback visibility for asynchronicity -- or more precisely, that in my use case I can get since I have vim-server compiled in, but the only way to have asynchronicity is to use background calls. Really, I suppose that you see foreground/background as visible/invisible, while I see it as potentially synchronous/certainly asynchronous, which is contributing to our fundamental disagreement. In some ways, for me the asynchronicity of foreground calls is also an unreliable API. Going back to the point in hand, I feel that exposing whether callbacks are available (providing the aforementioned Really, at this point I'm just waiting for neovim to come out with real async support, so that all of this stuff stops being a problem entirely. |
Adds an optional callback parameter to
dispatch#compile_command
. If this parameter is not present, it defaults to the old behaviour (callings:cgetfile
if this was a foreground request), but this allows library users to add custom behaviour (e.g. show quickfix after background requests are done, open the location list rather than the quickfix list).This should make vim-dispatch more flexible for use by other plugins (see #47, LaTeX-Box#106 or synctastic#699), but doesn't break current APIs.