This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-30
Channels
- # adventofcode (22)
- # announcements (7)
- # beginners (32)
- # calva (56)
- # cider (96)
- # cljdoc (7)
- # cljs-dev (50)
- # clojure (173)
- # clojure-austin (8)
- # clojure-brasil (7)
- # clojure-europe (10)
- # clojure-greece (2)
- # clojure-italy (10)
- # clojure-nl (9)
- # clojure-spec (18)
- # clojure-uk (143)
- # clojurebridge (3)
- # clojurescript (9)
- # cursive (14)
- # data-science (1)
- # datascript (4)
- # datomic (9)
- # docker (7)
- # emacs (2)
- # figwheel-main (4)
- # fulcro (18)
- # garden (1)
- # graphql (13)
- # hyperfiddle (4)
- # juxt (2)
- # off-topic (43)
- # pathom (1)
- # pedestal (17)
- # portkey (163)
- # re-frame (4)
- # reitit (7)
- # rum (4)
- # shadow-cljs (139)
- # spacemacs (5)
- # sql (14)
- # unrepl (2)
[nREPL] Starting server via /Users/achikin/.nvm/versions/node/v8.11.2/bin/npx shadow-cljs -d org.clojure/tools.nrepl:0.2.13 -d cider/piggieback:0.3.9 -d refactor-nrepl:2.4.0 -d cider/cider-nrepl:0.18.0 server...
Quit [2 times]
[nREPL] server started on 54547
[nREPL] Establishing direct connection to localhost:54547 ...
[nREPL] Direct connection to localhost:54547 established
[nREPL] Establishing direct connection to localhost:54547 ...
[nREPL] Direct connection to localhost:54547 established
error in process filter: user-error: Figwheel-sidecar is not available. Please check
error in process filter: Figwheel-sidecar is not available. Please check
I'm migrating from figwheel to shadow. Maybe that's because I still have figwheel configuration bits in the project.clj
.
Anyway, as far as I understand I can remove sidecar safely and still be able to use shadow-cljs
, right?
Show: Project-Only All
Hide: Clojure Java REPL Tooling Duplicates (23 frames hidden)
1. Unhandled clojure.lang.ExceptionInfo
missing instance
{}
core.clj: 4739 clojure.core/ex-info
core.clj: 4739 clojure.core/ex-info
runtime.clj: 11 shadow.cljs.devtools.server.runtime/get-instance!
runtime.clj: 8 shadow.cljs.devtools.server.runtime/get-instance!
api.clj: 130 shadow.cljs.devtools.api/worker-running?
api.clj: 128 shadow.cljs.devtools.api/worker-running?
api.clj: 207 shadow.cljs.devtools.api/watch
api.clj: 201 shadow.cljs.devtools.api/watch
api.clj: 205 shadow.cljs.devtools.api/watch
api.clj: 201 shadow.cljs.devtools.api/watch
REPL: 1 user/eval55989
REPL: 1 user/eval55989
Compiler.java: 7062 clojure.lang.Compiler/eval
Compiler.java: 7051 clojure.lang.Compiler/eval
Compiler.java: 7025 clojure.lang.Compiler/eval
core.clj: 3206 clojure.core/eval
core.clj: 3202 clojure.core/eval
main.clj: 243 clojure.main/repl/read-eval-print/fn
main.clj: 243 clojure.main/repl/read-eval-print
main.clj: 261 clojure.main/repl/fn
main.clj: 261 clojure.main/repl
main.clj: 177 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 652 clojure.core/apply
regrow.clj: 18 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 1965 clojure.core/with-bindings*
core.clj: 1965 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
The same happens if I start shadow-cljs server manually and do cider-connect-sibling-cljs
I might be able to help here, could you open an issue on cider with the commands that you are running by any chance? I am using shadow day in day out so I can help with the debugging...today is tough cause I am at the Conj but I can have a look at it this evening if you open an issue
@U0C8489U6 I have managed to run it, thanks to Thomas Heller. But I still have some questions. Seems like jump to definition
does not work properly for cljs files
Yeah well that was a bug in there that I fixed, if you give me an example or better open an issue I can have a look at it
@U0C8489U6 which set up do you suggest? embedded shadow-cljs server or a standalone one?
Standalone is what I use but it should not matter for the jump to definition
@U0C8489U6 could you tell me if I'm setting the things up correctly? 1. start shadow-cljs server 2. start shadow-cljs build watch 3. cider-connect
Last step is cider-connect-cljs
for me and usually watch is also starting the server so you should be good with only that
@U0C8489U6 it looks like when I do cider-connect-cljs
cider does not parse `.shadow-cljs/.*port files. Am I right?
Uhm It should?
@U0C8489U6 when I do cider-connect-cljs
it automatically finds and parses .nrepl-port
of a running lein
repl.
in my case it does the same with shadow-cljs
Not really. At this point it seems the EDN transport and the Transit transports are much better options for ClojureScript clients.
Gotcha, makes sense. bencode would probably be a bit of a pain to debug in the browser.
the only benefit of bencode is that there would be no client/nrepl clash of dependencies to worry about. high probability of there being transit in the project itself and maybe problems arise because of that?
what if different transports are registered for edn in cider versus the actual project.
my point is that the project might have EDN and transit with special encoders that clash with what cider wants to do. just speculating no idea
Yeah, exactly (re EDN). Transit is pretty slow moving too. I doubt having a newer version would cause problems on either side.
I really don’t get the EDN part - nREPL’s messages are usually maps of basic types. Does someone mess with those ever?
I don't want to go on too much of a tangent re encoding. Mostly I'm just wondering where the best place to help out on the ClojureScript side of things is.
I’d start https://github.com/clojure-emacs/cljs-tooling or https://github.com/nrepl/piggieback
Btw, I’m not saying that porting nrepl/bencode to ClojureScript is a waste of time, either. I was just under the impression EDN and Transit were adequate solutions for client authors.
I suspect that's mostly the case which is why I asked. Porting bencode would actually be fun since it's relatively standalone, but I figured it probably wasn't the best investment of time at this point.
Hi all
How can I change the cider-nrepl version that is picked up?
I want to use cider/cider-nrepl 0.18.0 and not 0.19.0-SNAPSHOT
My ~/.lein/profiles.clj
looks like:
{:repl {:plugins [[cider/cider-nrepl "0.18.0"]
[refactor-nrepl "2.3.1"]]
:dependencies [[alembic "0.3.2"]
[org.clojure/tools.nrepl "0.2.13"]]}}
and in the app:
{:dev
{:dependencies [[figwheel-sidecar "0.5.16"]
;; [day8.re-frame/trace "0.1.13"]
[org.clojure/test.check "0.9.0"]
[cider/cider-nrepl "0.18.0"]
[org.clojure/tools.nrepl "0.2.13"]
[cider/piggieback "0.3.10"]
[re-frisk "0.5.3"]]
But it still picks up 0.19.0-SNAPSHOT from somewhere
I am using Spacemacs
@erwinrooijakkers it's a cider option in emacs
it's kind of not an option any longer. It's added to risky var which makes it a pain to override in dir-locals because you have to accept the risky values in every file.
(defvar cider-jack-in-lein-plugins nil
"List of Leiningen plugins to be injected at jack-in.
Each element is a list of artifact name and version, followed optionally by
keyword arguments. The only keyword argument currently accepted is
`:predicate', which should be given a function that takes the list (name,
version, and keyword arguments) and returns non-nil to indicate that the
plugin should actually be injected. (This is useful primarily for packages
that extend CIDER, not for users. For example, a refactoring package might
want to inject some middleware only when within a project context.)")
(put 'cider-jack-in-lein-plugins 'risky-local-variable t)
(cider-add-to-alist 'cider-jack-in-lein-plugins
"cider/cider-nrepl" cider-latest-middleware-version)
and cider-latest-middleware-version
is read at startup time and added to the list not dynamically at jack in
Okay I ask because I have this problem:
I get this very strange error suddenly when connecting to a MySql database:
Could not create connection to database server.
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
(...)
Caused by: java.lang.ClassCastException: java.io.BufferedWriter cannot be cast to java.io.PrintWriter
at cider.nrepl.middleware.out$print_stream$fn__52939.invoke (out.clj:99)
This only happens when I run via cider-jack-in
With lein repl
it works
easiest way to check is to hand edit the cider-latest-middleware-version
to 0.18 and try it with jacking in to see if its a regression or not
Can it have to do with https://github.com/clojure-emacs/cider-nrepl/commit/658194a8abb0842cbc3efe4f7cb04917487785d2?
Ow so I can overwrite that one
Thanks
yeah. it's all just elisp. just go to the source and change it, restart emacs and bob's your uncle
Where is the cider-latest-middleware-version
located?
That’s it
I need to find cider.el
It’s here: ~/.emacs.d/elpa/cider-20181128.1311
yay got it
Now Cider says: Source file '/Users/erooijak/.emacs.d/elpa/cider-20181128.1311/cider.el' newer than byte-compiled file
And it keeps using the old one
M-x byte-recompile-directory RET ~/.emacs.d/elpa/
and Bob’s my uncle
Argh not ye
It works
Had to restart Emacs
Alright the hour of truth
bob is now officially you're uncle 🙂 also now you know how to edit/patch/hack on CIDER.
Yes I work on a need-to-know basis
When using Cider 0.18.0 the error no longer appears
file an issue. that was a recent change in a very murky place. would love to have a minimal repro as well if possible ?
Well that’s difficult
I need some help then
Stack trace:
Caused by: java.lang.ClassCastException: java.io.BufferedWriter cannot be cast to java.io.PrintWriter
at cider.nrepl.middleware.out$print_stream$fn__53158.invoke (out.clj:99)
cider.nrepl.middleware.out.proxy$java.io.OutputStream$ff19274a.write (:-1)
java.io.PrintStream.write (PrintStream.java:480)
sun.nio.cs.StreamEncoder.writeBytes (StreamEncoder.java:221)
sun.nio.cs.StreamEncoder.implFlushBuffer (StreamEncoder.java:291)
sun.nio.cs.StreamEncoder.flushBuffer (StreamEncoder.java:104)
java.io.OutputStreamWriter.flushBuffer (OutputStreamWriter.java:185)
java.io.PrintStream.write (PrintStream.java:527)
java.io.PrintStream.print (PrintStream.java:669)
java.io.PrintStream.println (PrintStream.java:806)
com.mysql.jdbc.log.StandardLogger.logInternal (StandardLogger.java:318)
com.mysql.jdbc.log.StandardLogger.logWarn (StandardLogger.java:240)
com.mysql.jdbc.MysqlIO.doHandshake (MysqlIO.java:1177)
com.mysql.jdbc.ConnectionImpl.coreConnect (ConnectionImpl.java:2255)
com.mysql.jdbc.ConnectionImpl.connectOneTryOnly (ConnectionImpl.java:2286)
com.mysql.jdbc.ConnectionImpl.createNewIO (ConnectionImpl.java:2085)
com.mysql.jdbc.ConnectionImpl.<init> (ConnectionImpl.java:795)
com.mysql.jdbc.JDBC4Connection.<init> (JDBC4Connection.java:44)
sun.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2)
sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance (Constructor.java:423)
com.mysql.jdbc.Util.handleNewInstance (Util.java:404)
com.mysql.jdbc.ConnectionImpl.getInstance (ConnectionImpl.java:400)
com.mysql.jdbc.NonRegisteringDriver.connect (NonRegisteringDriver.java:327)
java.sql.DriverManager.getConnection (DriverManager.java:664)
java.sql.DriverManager.getConnection (DriverManager.java:208)
clojure.java.jdbc$get_connection.invokeStatic (jdbc.clj:272)
clojure.java.jdbc$get_connection.invoke (jdbc.clj:193)
clojure.java.jdbc$db_query_with_resultset.invokeStatic (jdbc.clj:848)
clojure.java.jdbc$db_query_with_resultset.invoke (jdbc.clj:818)
clojure.java.jdbc$query.invokeStatic (jdbc.clj:874)
clojure.java.jdbc$query.invoke (jdbc.clj:854)
yesql.generate$query_handler.invokeStatic (generate.clj:89)
yesql.generate$query_handler.invoke (generate.clj:82)
yesql.generate$generate_query_fn$real_fn__32447.invoke (generate.clj:120)
yesql.generate$generate_query_fn$query_wrapper_fn__32454.invoke (generate.clj:142)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.invoke (RestFn.java:421)
(.write ^PrintWriter @printer (String. byte-range))
The printer is a BufferedWriter
And PrintWriter is not a BufferedWriter
They both inherit from java.io.Writer
though
But I don’t know why in this case we are dealing with a BufferedWriter
And I really don’t understand why it only happens when calling the endpoint, but not from the REPL.
I made an issue where I describe what I know: https://github.com/clojure-emacs/cider-nrepl/issues/570
I don’t see why it can be anything else than a PrintWriter
(defn tracked-sessions-map-watch [_ _ _ new-state]
(let [out-writer (forking-printer (vals new-state) :out)
err-writer (forking-printer (vals new-state) :err)]
(alter-var-root #'*out* (constantly out-writer))
(alter-var-root #'*err* (constantly err-writer))
(System/setOut (print-stream #'*out*))
(System/setErr (print-stream #'*err*))))
Since forking-printer returns a PrintWriter
I added a PR https://github.com/clojure-emacs/cider-nrepl/pull/571, although I am not yet sure why it happens. My time is up! 😄
Thanks for the help!!!