tpope / vim-fireplace

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

Handle early transport exit #351

Closed dhleong closed 5 years ago

dhleong commented 5 years ago

If the remote end terminates the connection before sending a "status" message, exit_callback will be called before the transport is registered for the url. This can be reproduced by trying to Piggieback onto a shadow-cljs repl as if it were a figwheel repl (ex: Piggeback (figwheel-sidecar.repl-api/repl-env) instead of Piggieback :app)

tpope commented 5 years ago

I don't understand. My reading of fireplace#transport#connect() is that it's impossible to get an object out of it without it existing in s:urls. Possibly there's a bug in the Python script that causes it to exit without sending a status, but that would happen long before :Piggieback gets a chance to do anything.

dhleong commented 5 years ago

Ah, sorry, that was a bit of a red herring. The real issue is that the connection is refused because I'm trying to connect to the wrong port. Calling Connect directly with an incorrect port, however, results in this:

Vim(call):E716: Key not present in Dictionary: nrepl://localhost:1234

Adding the if results in the more obvious:

Fireplace: Connection Error: Connection refused
tpope commented 5 years ago

I'm afraid this might replace one edge case with another, but I'll merge for now.