-
Notifications
You must be signed in to change notification settings - Fork 177
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
Migrate to nREPL 0.4 #540
Migrate to nREPL 0.4 #540
Conversation
LGTM, will try to make time to test it locally. |
Codecov Report
@@ Coverage Diff @@
## master #540 +/- ##
=======================================
Coverage 73.33% 73.33%
=======================================
Files 36 36
Lines 2306 2306
Branches 136 136
=======================================
Hits 1691 1691
Misses 479 479
Partials 136 136
Continue to review full report at Codecov.
|
The changes seem trivial, but for some reason this doesn't work right. When I try evaluation with nREPL 0.4 alone everything is fine, when I add the middleware I can connect to the server but afterwards evaluation locks up. So far I couldn't find what exactly is going wrong, so I'd certainly appreciate some help in testing this. |
That's what happens for me. Everything in the init sequence seems fine. My only guess is that init-debug might be causing some lockup but I haven't checked this yet. Such a mystery... |
After a bit of trial and error and I've reduced the problem to "something's wrong with track-state". Disabling this middleware fixes the hang and everything else works fine. Now the question is what's wrong with track-state, as everything seems fine to me. Maybe @dpsutton would have some insight, as I recall he spent some "quality" time a while ago debugging it. :-) |
Actually it seems that some things continue to be broken even with track-state disabled (e.g. eldoc). That's one hell of a mystery! |
Likely last update from me for today, as this got me extremely pissed off - seemed like some problem with |
One lesson that i learned from the cemerick -> cider transition for piggieback: Let's make a release of the new nrepl under the new namespaces that is identical in all respects except for the namespaces. This makes sure that everyone can move to the new nrepl and the tooling doesn't need to case on one or the other. that was a pain. |
sorry just noticed you've done exactly that. just getting up to speed on the nrepl changes. sorry. |
No problem. Obviously dealing with this is not my dream in life, but it's the only way to fix the fundamental problems. Otherwise we can just pack up shop even now, because I'm done dealing with the limitations of the legacy nREPL and I'd rather just abandon the work on CIDER completely instead of wasting my time. Btw, if you look at the version in the branch you'll see it's 0.19, instead of 0.18 because I want to work on this in parallel with 0.18 and give people so time to adjust other related packages. I'm well aware there'll be some frustration after this release, but I didn't think the frustration would be not being able to even update the middlewares. :-) |
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-apropos, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-classpath, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-complete, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-debug, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-enlighten, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-format, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-info, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-inspect, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-macroexpand, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-slurp, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-ns, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-out, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-content-type, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-slurp, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-pprint, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-pprint-fn, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-profile, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-refresh, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-resource, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-spec, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-stacktrace, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-test, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-trace, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-tracker, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-undef, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.nrepl/wrap-version, see clojure.tools.middleware/set-descriptor!
nREPL server started on port 38431 on host :: - nrepl://:::38431
Jul 18, 2018 12:15:49 AM clojure.tools.logging$eval429$fn__432 invoke
SEVERE: Unhandled REPL handler exception processing message {:op out-subscribe, :session 7c5592c7-43f3-4aff-9f23-04acbe3c8faf, :id 7}
java.lang.IllegalAccessError: newline? is not public, compiling:(clojure/tools/reader/reader_types.clj:1:1) lots of info in the |
and that last line is very strange: |
@dpsutton Are you start nREPL 0.2 or 0.4? You'd be seeing such warnings with 0.2, but not with 0.4. |
i'm not positive. i'm trying to lein install nREPL 0.4.1 and the cider-nrepl with this patch applied. easy to get lost in this stuff :) I had to modify CIDER's version string to 0.19-snapshot so it would ask for that installed version of cider-nrepl which would use the new nREPL. Quite possible i have a missing link in there somewhere. |
ok yes i am seeing tools nrepl 0.2.x showing up in m2. not sure where i've gone wrong |
@dpsutton I think it's easiest to use https://github.com/nrepl/lein-nrepl to start nREPL 0.4. I do:
You'll get a warning in CIDER about the version mismatch, but obviously you can safely ignore that. |
[dan@fedora fizzbuzz]$ lein nrepl :middleware "['cider.nrepl/cider-middleware']"
(:middleware ['cider.nrepl/cider-middleware'])
Exception in thread "main" java.lang.ClassNotFoundException: leiningen.nrepl, compiling:(/tmp/form-init7845473687617269713.clj:1:73)
not sure what's up with that. i'll have to look in the morning. its quite late now. I'm gonna dig into this with you @bbatsov . This sucks its being so strange. |
Seems like a bug in the plugin I've created, although I can't figure this one out as well. It's just a super standard one file lein plugin. |
@@ -110,7 +110,7 @@ | |||
|
|||
(defn flag-tooling | |||
"Walk the call stack from top to bottom, flagging frames below the first call | |||
to `clojure.lang.Compiler` or `clojure.tools.nrepl.*` as `:tooling` to | |||
to `clojure.lang.Compiler` or `nrepl.*` as `:tooling` to | |||
distinguish compilation and nREPL middleware frames from user code." | |||
[frames] | |||
(let [tool-regex #"^clojure\.lang\.Compiler|^clojure\.tools\.nrepl|^cider\." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the clojure\.tools\.nrepl
in the regex also be changed to just nrepl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it should be changed.
I got same error as above testing with https://github.com/nrepl/lein-nrepl
Exploring other option, using clj deps (without lein) seems there is no problem at all, can connect and repl-ing normally, midleware work as expected. The gist i put here: https://gist.github.com/reedho/3d3aeb805f20fc6f3aec03881c74cab4 My best guess is that |
I managed to get the contents of that temp file that is throwing the error:
|
to contrast, other tmp files have (try (clojure.core/require (quote cider.nrepl)) (catch java.lang.Throwable t__11809__auto__ (clojure.core/println "Error loading" (clojure.core/str (quote cider.nrepl) ":") (clojure.core/or (.getMessage t__11809__auto__) (clojure.core/type t__11809__auto__))))) in them. not sure why these have a created require message in them but that would explain the "what the heck is leiningen.repl" message we are seeing |
https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md#evaluating-in-project-context this seems to be an abuse of eval in project apparently. |
@dpsutton Yeah, I also figured this out in the morning (and not just me nrepl/lein-nrepl#1). I really wished this produced a more meaningful error, though. Now I'm wondering what's the best course of action. Probably it's best to add this dep if it's not in the project deps, but I'm not a Lein expert and I don't know what's the best strategy there. |
@reedho Wow! You're probably right! Lein has a hard dep on the old nREPL, but I didn't think it could mess something up because of the different namespaces. Likely, however, that's not completely true. |
I'm not sure what else could collide here? I suppose this can easily be verified via the |
Nope, you can have new & old nrepl alongside one another. |
@SevereOverfl0w Yeah, that's what I plan to do when I find some time. But I did notice yesterday I can't jack in the nREPL project, so I guess something goes sideways when the two jars nREPLs are present. |
@SevereOverfl0w For me the problems started only after adding the |
Guess @reedho is right and something's getting messed up because of lein's nREPL dep. At least we're making progress. Hopefully with Boot there will be no such problems (I'll leave it to @arichiardi to test this). Now we have to figure out exactly what's going wrong with |
I don't think it is because of the nrepl dep:
|
Well, for some reason it works fine like this and it doesn't work with |
Just checked this pull (4bf683b) against latest nrepl/lein-nrepl@366bbea, things works fine.
|
Yep, seems we're all good. I haven't tested only the boot support, but probably everything's fine there as well. I'll write some notes about using this with CIDER and I'll leave this open for now, until 0.18 is released. @vspinu asked us to postpone the release a bit. In the mean time I'll update piggieback (likely to support both nREPLs) and ping @thheller and @bhauman to add some support for nREPL 0.4 as well. The changes they'll have to make to support both nREPLs should be small. |
Big thanks to everyone who helped with this! In case someone's curious what the problem turned out to be - the short story is that I wrote a very buggy lein plugin. :-) I really need to read up on Leiningen one of those days... |
Can confirm it works with |
Support with tools.nrepl is kept for now with the assumption that tools.nrepl namespaces would be loaded automatically by `lein repl` or `boot repl`. Support for tools.nrepl will likely be removed after a couple of releases (once mainstream Lein and Boot switch to nREPL 0.4).
The actual work went into 0.18 (15d8774) |
An initial stab at updating the middleware for nREPL 0.4.
That's going to be part of the 0.19 release (or at least that's the current plan).
Any volunteers to test with using https://github.com/nrepl/lein-nrepl? (use
lein install
to build the artefact locally)