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

Support new nrepl 0.4.4 library #318

Closed thiru closed 5 years ago

thiru commented 6 years ago

I wonder if you would consider supporting the new nrepl library: https://github.com/nrepl/nREPL/

The old one will be deprecated I suppose. I think it'll just be a matter of changing the namespace. The API seems to be otherwise compatible. I.e. change clojure.tools.nrepl.* to nrepl.*

tpope commented 6 years ago

I don't see clojure.tools.nrepl anywhere in the source. What needs to change?

thiru commented 6 years ago

Hmm yes I looked through your plugin code and I couldn't find references to it either. Somehow it's getting called. Maybe through one of the dependencies your plugin takes?

So for instance, if I try to use the new nrepl 0.4.4 library I get the following stack trace in my REPL when I try to connect: :FireplaceConnect nrepl://localhost:7888

SEVERE: (#error {
 :cause No implementation of method: :send of protocol: #'clojure.tools.nrepl.transport/Transport found for class: nrepl.transport.FnTransport
 :via
 [{:type java.lang.IllegalArgumentException
   :message No implementation of method: :send of protocol: #'clojure.tools.nrepl.transport/Transport found for class: nrepl.transport.FnTransport
   :at [clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 583]}]
 :trace
 [[clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 583]
  [clojure.core$_cache_protocol_fn invoke core_deftype.clj 575]
  [clojure.tools.nrepl.transport$eval9416$fn__9417$G__9407__9424 invoke transport.clj 16]
  [clojure.tools.nrepl.middleware.session$register_session invokeStatic session.clj 144]
  [clojure.tools.nrepl.middleware.session$register_session invoke session.clj 137]
  [clojure.tools.nrepl.middleware.session$session$fn__10011 invoke session.clj 188]
  [clojure.tools.nrepl.middleware$wrap_conj_descriptor$fn__9660 invoke middleware.clj 22]
  [clojure.lang.Var invoke Var.java 381]
  [nrepl.server$handle_STAR_ invokeStatic server.clj 17]
  [nrepl.server$handle_STAR_ invoke server.clj 14]
  [nrepl.server$handle$fn__1167 invoke server.clj 26]
  [clojure.core$binding_conveyor_fn$fn__5476 invoke core.clj 2022]
  [clojure.lang.AFn call AFn.java 18]
  [java.util.concurrent.FutureTask run FutureTask.java 264]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1135]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 635]
  [java.lang.Thread run Thread.java 844]]} Unhandled REPL handler exception processing message {:id fireplace-tlap1-1533524985-6, :op clone})
thiru commented 6 years ago

For reference here's a sample project I've been testing against: https://github.com/thiru/fullstack-clojure

The master branch has a working project using the old nrepl library: org.clojure/tools.nrepl {:mvn/version "0.2.13"}

The nrepl044 branch is using the new library. So the steps to reproduce the error above is:

  1. Run clj in a terminal
  2. In the REPL: user=> (repls/start-nrepl-server!)
  3. In Vim: :FireplaceConnect nrepl://localhost:7888
Deraen commented 5 years ago

@thiru Fireplace is working fine with nrepl 0.4.5 for me in other projects.

Your project is broken because it is user cider-nrepl 0.17.0 but nrepl 0.4 requires 0.18.0.

thiru commented 5 years ago

Yup this works now - I just checked. Thanks @Deraen

The issue was with the 0.4.4 version. I believe I did try targetting the latest cider-nrepl but it didn't work. 0.4.5 seems to fix it.

@tpope, so it wasn't an issue with your plugin afterall.