tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

Neovim support (async) #202

Closed Deraen closed 5 years ago

Deraen commented 9 years ago

Hi,

Has there been any thought about adding Neovim support to Fireplace? Fireplace already works on Neovim but using Neovim's new plugin architecture would enable async support. I think this might be possible with few if has('nvim') tests and separate python files. Though a separate branch or fork would probably be easier at first than trying to support both Vim and Neovim.

Here are a few interesting links:

tpope commented 9 years ago

I don't personally have time to look into this. I can tell you I designed the APIs with async in mind (fireplace#message() takes a callback, for example). My guess is that adding a Neovim driven backend wouldn't be that hard, while making the currently synchronous frontend actually leverage it might be more challenging.

zamaterian commented 9 years ago

It could be pretty nice with omnicomple driven async instead of waiting.. especially if the lein repl isn't started up.

tpope commented 9 years ago

Does Neovim support async omnicomplete?

Deraen commented 9 years ago

I don't think omnifunc supports async (https://github.com/neovim/neovim/issues/396) but seems like it's possible to implement it using RPC and by triggering complete from some autocmds and bindings and finally calling complete with the results: https://github.com/Shougo/deoplete.nvim

justinmk commented 9 years ago

There's a clojure RPC client for Neovim but it is early stage.

mikepjb commented 7 years ago

Hey,

I'm looking to modify vim-fireplace to use make asynchronous calls to the nrepl.

Edit: So I had a closer look last night and moving the inline python code in nrepl_connection.vim to a seperate .py file opens the possibility to call it asynchronously with call job_start(command, opts)

As tpope said a while back, hooking up the frontend is the challenge, from using cpp to reaching the dispatch call there are 7 function calls that pass results between each other (s:eval => s:nrepl_eval => s:nrepl_process => s:nrepl_message => s:nrepl_call => s:nrepl_transport_call => s:nrepl_transport_dispatch)

Seperating the concerns of these functions should resolve the issue so I'll be working on this.

Edit2: I've got an async plugin setup for :Eval over here - https://github.com/michaelbruce/vim-link

It was tough working on this for vim-fireplace, I'd be interested in pairing with anyone that's interested and is more familiar with the internals of the project.

tidux commented 6 years ago

Vim now has async as of 8.1, so it's not just for neovim anymore.

tpope commented 5 years ago

Fireplace now uses jobs and supports asynchronous nREPL messaging. Asynchronous omnicomplete appears to be involved enough to require a third party plugin. @SevereOverfl0w is evaluating options.