Fork me on GitHub
#cider
<
2020-06-06
>
robert.mather.rmm01:06:43

[nREPL] Starting server via "c:/Program Files/nodejs/npx.cmd" shadow-cljs -d nrepl:0.4.5 -d cider/piggieback:0.3.10 -d refactor-nrepl:2.5.0 -d cider/cider-nrepl:0.19.0-SNAPSHOT server...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: shadow-cljs - config: c:\Users\my\project\path\shadow-cljs.edn
shadow-cljs - starting via "clojure"
=============================================================================
WARNING: The configured :dependencies in shadow-cljs.edn were ignored!
         When using :deps they must be configured in deps.edn
==============================================================================
clojure : Couldn't find 'java'. Please set JAVA_HOME.

At line:1 char:1

+ clojure -Sdeps `{:aliases` `{:shadow-cljs-inject` `{:extra-deps` `{nr ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-Clojure
Trying to cider-jack-in-cljs on Windows from Spacemacs. clojure CLI is installed and working when run directly from PowerShell. Also, $env:JAVA_HOME is correctly set. Any ideas or debugging tips?

dpsutton01:06:04

I see lots of ancient versions. You’re six versions back on cider and a major version back on piggieback and 3 major versions back on nrepl

dpsutton01:06:13

But also I’m seeing issues with deps.edn and shadow-cljs.edn fighting over who is in control

neo255119:06:12

@robert.mather.rmm Can you start shadow-cljs watch app?

neo255119:06:08

My experience with shadow-cljs is that is much better start the process in the terminal and connect to it from cider without C-c M-C

neo255119:06:24

Maybe remove your deps as well.

robert.mather.rmm20:06:44

@neo2551 Thanks, that's working much better. I'm used to Cursive, where I can stash one-off sexpers I want to eval inside a (comment ...) and send the "top-level" (not including the comment block) form to the REPL with a single command. Is there something similar in CIDER?

robert.mather.rmm20:06:19

I'm talking about nothing more than having the cursor/point somewhere within the form I want to eval, not highlighting it, or being right at the end or something. Being able to eval either the topmost containing form, or the immediately containing form would be nice.

dpsutton20:06:30

there is. check (setq clojure-toplevel-inside-comment-form t)

dpsutton20:06:02

i'm also a fan of

(setq cider-invert-insert-eval-p t)
(setq cider-switch-to-repl-on-insert nil)

dpsutton20:06:27

these should be similar to the way that cursive evals things in the repl buffer

dpsutton20:06:48

i like being able to choose to eval things without leaving a trace, and optionally, to send forms to the repl so see the input and output in the repl buffer

robert.mather.rmm20:06:19

Here's a fun one, what if I want to eval a form in the ns of the current buffer, but without switching the REPL ns. Let's say I want to stay in the 'user' ns because I have some utilities there, and want to eval something without polluting the 'user' ns

robert.mather.rmm20:06:20

So equivalent behavior to 'in-ns' into the buffer ns, eval the form, then 'in-ns' back.

neo255121:06:45

I usually go to the end of the sexp and eval it with C-x C-e

robert.mather.rmm21:06:51

Maybe this is something specific to Shadow-CLJS interaction, but I can't eval forms containing functions defined in the buffer. I get undeclared-var warnings that make it look like it's trying to eval under the 'cljs.user' ns even though the REPL buffer shows the correct ns.

thheller21:06:17

@robert.mather.rmm which version do you use?

robert.mather.rmm21:06:38

@thheller 'npm -g' installed 2.9.10 on Windows, calling from PowerShell

thheller21:06:58

do you use deps.edn? then only the version included there matters. the npm version is less relevant.

robert.mather.rmm21:06:35

I do, 2.10.0 in deps.edn

robert.mather.rmm21:06:35

I do, 2.10.0 in deps.edn

thheller22:06:14

dont use 2.10.0, it has a couple issues with cider. stick with 2.9.10

robert.mather.rmm22:06:24

Ok, I'll try that. Thanks

dpsutton21:06:22

Cider inline sends along the current namespace and it should be evaled there. Insert into repl will not silently adjust the repl like cursive does

robert.mather.rmm21:06:06

Ok. What I'm experiencing though: 1. Start 'shadow watch <build>' from CLI 2. Connect to nREPL from Cider with 'shadow-select' type 3. C-c C-k to load buffer (still see 'cljs.user', not file/buffer ns in REPL buffer) 4. C-c C-c doesn't work due to "Use of undeclared Var" from Shadow 5. C-c M-n n to set the REPL ns to match the buffer (seems to work, the REPL buffer changes to match the file ns) 6. C-c C-c still doesn't work with the same error

robert.mather.rmm21:06:25

So even though the Cider REPL buffer shows the correct ns in the prompt, the warnings coming back from Shadow show everything ns-qualified with 'cljs.user'

dpsutton21:06:37

i think there's a bug where CIDER needs its middleware on the classpath

robert.mather.rmm21:06:07

cider/cider-nrepl {:mvn/version "0.25.1"}

robert.mather.rmm21:06:22

Something other than that?

dpsutton21:06:02

where is that? in deps.edn?

dpsutton21:06:01

ok. let me keep looking then

robert.mather.rmm21:06:02

Thanks for the support

dpsutton21:06:07

my pleasure

robert.mather.rmm21:06:25

Shadow is configured to use deps.edn, just FYI

robert.mather.rmm21:06:37

This setup works for me from Cursive

dpsutton21:06:45

i'm able to C-c C-c and get eval inline

dpsutton21:06:49

and no errors in the repl about unbound vars

dpsutton21:06:38

i did diverge a bit from your steps. i'm not using deps.edn, and i did shadow-cljs -d cider/cider-nrepl:0.25.1 server and then issued the watch from the repl

dpsutton21:06:51

but i think this should more or less be equivalent

dpsutton21:06:29

what is your CIDER version? i thought i remember it being quite old

robert.mather.rmm21:06:42

=> nil So we diverge right there.

robert.mather.rmm21:06:14

CIDER 0.19.0snapshot (package: 20181021.830), nREPL 0.7.0

dpsutton21:06:16

can you try m-x nrepl-toggle-message-logging and try that again

robert.mather.rmm21:06:28

Wow, that is old.

dpsutton21:06:34

are you opposed to upgrading? i think we might be diagnosing a bug from over two years ago

robert.mather.rmm21:06:21

I'm using Spacemacs (new to Emacs), just followed their Clojure layer instructions. I'm surprised it's that far back by default.

robert.mather.rmm21:06:30

Not at all opposed, just not sure how.

dpsutton21:06:27

i think there is a #spacemacs channel. I don't use it so can't help you with that

robert.mather.rmm21:06:59

Ok, thanks. Sorry, didn't realize it was that far back.

dpsutton21:06:07

no worries at all

dpsutton21:06:23

but once you're up to date i'll work with you until you've got a happy repl experience

robert.mather.rmm22:06:16

@thheller @dpsutton Downgrading Shadow helped. Now I can get to a usable REPL, but there's still some disconnect in the state of the systems. For example, before explicitly loading the buffer (C-c C-k), I'm able to eval a pure function with C-c C-c and get the right result inline, but Shadow still warns "undeclared var". After loading, the warnings go away and things work cleanly.

robert.mather.rmm22:06:54

It's as though different systems are relying on different sources to determine the runtime state.

robert.mather.rmm22:06:14

Fortunately, this is good enough for me to get to work, so thank you both!

dpsutton23:06:35

do you have a repo that's very bare and can reproduce in?

dpsutton23:06:44

i'd like to run exactly what you are running

dpsutton23:06:09

ok. i can recreate in 2.10.4 when running with deps. no idea why this is different but at least i can reproduce now

dpsutton23:06:21

(-->
  id                             "14"
  op                             "eval"
  session                        "1fee8a75-f0c8-4546-8195-edba9b2588b0"
  time-stamp                     "2020-06-06 18:11:35.918714000"
  code                           "(defn ^:dev/after-load start []
  (r/render [app]
          ..."
  column                         1
  file                           "/Users/dan/projects/clojure/shadow/src/app/main.cljs"
  line                           11
  nrepl.middleware.print/print   "cider.nrepl.pprint/pr"
  nrepl.middleware.print/quota   1048576
  nrepl.middleware.print/stream? nil
  ns                             #("app.main" 0 8 (fontified t help-echo cider--help-echo cider-locals nil cider-block-dynamic-font-lock t face font-lock-type-face))
)
that seems like a valid nrepl message.

dpsutton23:06:16

i think shadow maybe used to load the namespaces when compiling. it seems like it now until the namespace has been created, evaluating in that is throwing an error. seems much closer to clojure and correct now i think