Fork me on GitHub
#cider
<
2021-03-06
>
macrobartfast03:03:28

I'm diving into the illustrious and awesome Biff framework. I'm not sure how I should be connecting to the terminal based repl that runs, in that framework, via ./task dev. I tried cider-connect-clj&amp;cljs, chose shadow, then :app. At that point: • I can evaluate a form in either repl buffer • I can evaluate a form in any clj buffer (via cider-eval-defun-at-point) • I can evaluate a form in any cljs buffer (via cider-eval-defun-at-point) if I switch to clojure-mode • However, if I evaluate a form in a cljs buffer using cider-eval-defun-at-point nothing occurs, either in the buffer or in either repl buffer I recall having this issue before several times in non-Biff projects, so it's likely how I'm going about it all. There are a myriad of permutations of how I could be connecting from Emacs... maybe I should be trying a different approach. Any thoughts or things to try?

macrobartfast03:03:07

If I recall, using cider-jack-in-clj&cljs often would solve this sort of problem in the past, but here I think I need to actually connect because Biff's ./task dev is doing other things. At any rate, doing so here produces

error in process sentinel: Could not start nREPL server: shadow-cljs - config: <path-to-project>/shadow-cljs.edn
shadow-cljs - connected to server
server already running

macrobartfast03:03:46

I just noticed that, whilst in a cljs file, when in clojurescript-mode I see

cider[not connected]
but if I switch to clojure-mode it shows as being connected.

macrobartfast03:03:06

But I do have a working cljs (as well as clj) repl buffer in all cases.

dpsutton03:03:01

this might be a longstanding issue. when in the cljs buffer, focus the cljs repl and then focus the cljs buffer again. do not go into the clj repl. it only "sees" the last repl you were in

macrobartfast04:03:54

Ah, yes. That has worked in the past. Here, unfortunately, it doesn't. 😞

macrobartfast04:03:28

actually, hang on while I monkey around with variations on that.

macrobartfast04:03:14

Well, that fix not working this time.

macrobartfast04:03:28

But it's good to remember that one; it's helped in numerous occasions.

macrobartfast04:03:18

The project team primarily use piggieback and Vim, if that's any help.

macrobartfast04:03:39

the cljs repl says 'REPL[pending-cljs]' in the status bar, but does eval forms.

dpsutton04:03:53

Can you eval (js/alert “hi”)?

dpsutton04:03:09

I’m guessing it will say unknown namespace js

dpsutton04:03:38

If so you need to connect to the js runtime as it’s still a clj repl. Load the webpage or run the node script

macrobartfast04:03:26

yep...

Caused by: java.lang.RuntimeException: No such namespace: js

dpsutton04:03:10

Yeah. Is this a web app? If so load it up in the browser

dpsutton04:03:16

You need a js engine

macrobartfast04:03:06

It is a web app... it is loaded in the browser... I just reloaded it without success.

dpsutton04:03:48

Is figwheel on your class path ? As a dependency somewhere

macrobartfast04:03:59

let me grep for that.

dpsutton04:03:21

So to step back, you need an nrepl server that has cider and piggieback involved so that it can handle the js stuff for you

macrobartfast04:03:16

searching for piggieback... the project creator is a Vim user, so I don't know if that completely crosses over... https://github.com/jacobobryant/biff

macrobartfast04:03:43

I should just use Vim, but I'm so... addicted... to Emacs.

macrobartfast04:03:26

He does evaluate from within a cljs file in Vim in one of his demonstrations, for what it's worth.

blak3mill3r04:03:30

you can definitely use piggieback + emacs

macrobartfast04:03:54

If it works for him in Vimland... does that imply it has what I need as an Emacsoid?

macrobartfast04:03:20

It seems like he'd also need piggieback... but that's way over my head at this point.

blak3mill3r04:03:23

I use piggieback+emacs+cider and it works wonderfully for me

blak3mill3r04:03:27

but, you mention that

blak3mill3r04:03:35

you have some clj buffers and some cljs buffers

blak3mill3r04:03:48

and, while I understand that this does work for some people, I haven't used it that way

blak3mill3r05:03:02

I'm generally writing one or the other, in a particular instance of emacs

macrobartfast05:03:10

things eval in the clj and cljs repl buffers, and in clj files, and clj will eval in cljs buffers when in clojure-mode...

blak3mill3r05:03:13

I think it should work fine with 2 nrepl connections

blak3mill3r05:03:36

yes but when you are setting clojure-mode in your cljs buffer, are you sure it is evaluating clojurescript and not clojure?

blak3mill3r05:03:48

Caused by: java.lang.RuntimeException: No such namespace: js

blak3mill3r05:03:59

looks suspiciously like you are sending clojurescript code to your JVM clojure process

macrobartfast05:03:06

I am guessing it is eval'ing clojure.

blak3mill3r05:03:18

what you want to do is use piggieback

blak3mill3r05:03:26

to sort of switch modes...

blak3mill3r05:03:35

you can also have 2 active CIDER connections

macrobartfast05:03:37

I wonder where I'd add that in to this framework (https://github.com/jacobobryant/biff) then...

blak3mill3r05:03:37

2 repl buffers

blak3mill3r05:03:00

I haven't seen this biff framework, I will take a look

macrobartfast05:03:13

because the last I understood anything was in the glorious simple days of project.clj and so on.

macrobartfast05:03:25

Then the clone wars happened, things got complicated, and all that.

macrobartfast05:03:53

Biff is actually phenomenal. But it's what one would call a 'learning opportunity' for a simpleton like me.

blak3mill3r05:03:47

you are using figwheel; figwheel's cljs-repl supports (expects, I think) piggieback to be on your classpath

blak3mill3r05:03:54

are you using leiningen?

blak3mill3r05:03:28

is your name a play on Slartibartfast?

macrobartfast05:03:32

I normally do, but here I run the framework's

./task dev
and I should try to find out what that is doing more.

macrobartfast05:03:53

It is composed of simple Clojure idioms, however.

blak3mill3r05:03:51

it's an extremely short bash script

macrobartfast05:03:59

haha... and yes, my name is indeed a play on Slartibartfast. 😀

blak3mill3r05:03:22

I'd rather be happy than right, any day

macrobartfast05:03:46

"Perhaps I'm old and tired, but I think that the chances of finding out what's actually going on are so absurdly remote that the only thing to do is to say, "Hang the sense of it," and keep yourself busy. I'd much rather be happy than right any day."

macrobartfast05:03:57

haha... our messages crossed, lol.

blak3mill3r05:03:22

cider/piggieback {:mvn/version "0.4.1"}

blak3mill3r05:03:37

^ add this to your ~/.clojure/deps.edn (or to your project's deps.edn)

blak3mill3r05:03:25

sorry that version is not up to date

blak3mill3r05:03:34

there are some other dependencies too which you may or may not already have

blak3mill3r05:03:45

:aliases {:nrepl
          {:extra-deps
            {nrepl/nrepl {:mvn/version "0.8.2"}
             cider/piggieback {:mvn/version "0.5.2"}}}}
^ these are recent, from the figwheel README

macrobartfast05:03:18

it goes under :aliases?

blak3mill3r05:03:18

I believe you need to configure figwheel to use cider/piggieback too

blak3mill3r05:03:41

yes :aliases is one way to do it

macrobartfast05:03:43

Bruce is straight out of Hitchhikers.

blak3mill3r05:03:56

it depends if you think that figwheel is a personal development tool

blak3mill3r05:03:01

or part of your projects dev dependencies

blak3mill3r05:03:07

you can put it in the project's deps.edn

blak3mill3r05:03:20

if you want other users of your app to have it for sure

blak3mill3r05:03:44

your figwheel config probably wants to configure the nREPL middleware

macrobartfast05:03:45

I'm putting it in globally.

blak3mill3r05:03:52

see where it says

Load CIDER, refactor-nrepl and piggieback middleware

macrobartfast05:03:06

piggieback, that is.

blak3mill3r05:03:09

without that it will sort of work in a crippled way (lots of CIDER features missing)

macrobartfast05:03:34

ok... trying to get that all in.

blak3mill3r05:03:20

I am trying to catch up on what biff is doing when you run ./task dev

blak3mill3r05:03:30

but you do have figwheel running, right?

blak3mill3r05:03:55

I have a function in my clojure dev namespace that first starts figwheel and then calls figwheel-sidecar.repl-api/cljs-repl

blak3mill3r05:03:05

which converts the clojure nREPL connection to a clojurescript one, using piggieback

macrobartfast05:03:06

I don't know if I do...

macrobartfast05:03:46

that is, if I have figwheel running.

macrobartfast05:03:07

I once understood things... barely... then boot came along, then the successors...

blak3mill3r05:03:11

is the code something you can share?

blak3mill3r05:03:31

or, if I generate a new empty biff project and get emacs+cider+piggieback working would that help?

macrobartfast05:03:40

omg, tremendously.

macrobartfast05:03:09

I would also then be the rather dubious Biff Emacs integration expert, as well.

macrobartfast05:03:44

Presumably I could write it up for the Biff docs.

macrobartfast05:03:29

And eventually add it to the project, for the Emacsians. But I'd probably have folks here audit it first, lol.

blak3mill3r05:03:34

I am fiddling about

macrobartfast05:03:42

OK, I'll shut up.

blak3mill3r05:03:49

haha, not what I meant

blak3mill3r05:03:34

did you say that you were using figwheel? because it seems like my newly generated biff project uses shadow-cljs

blak3mill3r05:03:51

I see nothing indicating that it uses figwheel

macrobartfast05:03:27

I don't even know what I am using... I connect via cider-connect-clj&cljs from within Emacs.

macrobartfast05:03:45

So I don't know if that implies figwheel or not.

dpsutton05:03:48

how are you starting the repl?

blak3mill3r05:03:14

with this arcane bash stuff in biff ... I am looking into what it does

macrobartfast05:03:15

Well, in this case, the repl is started by the framework...

blak3mill3r05:03:23

dev () {
  if ! [ -e node_modules ]; then
    init
  fi
  npx onchange -i tailwind.css -- ./task build-css-dev &
  trap 'kill $(jobs -p) 2> /dev/null' EXIT
  mopt="-A"
  if clj -Sdescribe | grep -q repl-aliases; then
    mopt="-M"
  fi
  BIFF_ENV=dev clj $mopt:cljs "[email protected]" -m $MAIN_NS
}

blak3mill3r05:03:26

that's what it does ^

blak3mill3r05:03:32

when you run ./task dev

dpsutton05:03:35

yeah. its crazy. yes. so are you calling ./task dev?

macrobartfast05:03:35

thank you, was just about to paste it.

dpsutton05:03:55

ok. i'm not sure how you're even connecting to that. i don't see any nrepl getting started or involved

blak3mill3r05:03:57

and, when I did this, I got some complaints about it not finding cider/nrepl and refactor-nrepl/middleware

macrobartfast05:03:06

hang on, let me look.

dpsutton05:03:32

i'm confused why it even has an nrepl server. that's just calling clj -M:cljs -m example.core or whatever

blak3mill3r05:03:58

perhaps they bake it in

macrobartfast05:03:38

I'm digging around, but pretty slow on the uptake on this.

macrobartfast05:03:35

when you run ./task dev, this is in the output in the terminal:

Downloading: cider/piggieback/0.5.2/piggieback-0.5.2.pom from clojars

blak3mill3r05:03:13

is that because you added piggieback as a dependency in your ~/.clojure/deps.edn perhaps?

dpsutton05:03:29

ok. so shadow is in charge of the nrepl stuff. but there's no middleware so CIDER can't work with it. wont need piggieback in a shadow-cljs project

dpsutton05:03:43

so that's not an issue. its just getting shadow setup with the correct middleware

macrobartfast05:03:53

I don't think so... you do finally get

shadow-cljs - nREPL server started on port 7888

dpsutton05:03:59

and the main ns calls biff/start-system with its own map

blak3mill3r05:03:22

cider docs have instructions on cljs jack-in with shadow-cljs here https://docs.cider.mx/cider/cljs/shadow-cljs.html#using-cider-jack-in-cljs

blak3mill3r05:03:50

@macrobartfast I thought I understood you to say that you were using figwheel, but I think that is not the case... maybe I misunderstood

macrobartfast05:03:59

I tried cider-jack-in-cljs but had issues...

dpsutton05:03:27

this stuff is absolutely crazy and i can't see you getting it running with CIDER unless you're an expert

dpsutton05:03:50

(nrepl/start-server :port 7888) is burried in biff.components and is called by biff/start-system

macrobartfast05:03:57

well, that's helpful to know...

blak3mill3r05:03:00

haha this framework looks ... deep ... I am trying to get it to work with jack-in-cljs

blak3mill3r05:03:19

it looks cool but yeah, adding cider+cljs is not going to be super obvious

macrobartfast05:03:56

I had thought it was just a matter of choosing the right cider command in Emacs or whatnot, lol...

dpsutton05:03:23

some things you could do is pass :biff.init/start-nrepl false and be in charge of your own nrepl server. but the challenge is that all of this stuff is kinda twice removed from your own project

dpsutton05:03:01

so you need to tell it to not do anything and then do everything correctly yourself. but the css is watched in some random shell scripts, the nrepl and shadow started elsewhere, etc

dpsutton05:03:46

i don't care for this kind of thing. i much prefer you being in control of starting nrepl, and shadow.

(defn init [sys]
  (let [env (keyword (or (System/getenv "BIFF_ENV") :prod))
        unmerged-config (bu/catchall (edn/read-string (slurp "config/main.edn")))
        config (some-> unmerged-config (merge-config env))
        {:biff/keys [first-start dev]
         :biff.init/keys [start-nrepl start-shadow]
         :as sys} (merge sys config {:biff/unmerged-config unmerged-config})]
    (let [start-nrepl (if (some? start-nrepl) start-nrepl (not dev))
          start-shadow (if (some? start-shadow) start-shadow dev)]
      (when (and first-start start-nrepl)
        (nrepl/start-server :port 7888))
      (when (and first-start start-shadow)
        ; Without this, I sometimes get the following when loading localhost:9630:
        ; java.lang.Exception: Unable to resolve spec: :edn-query-language.core/property
        (require 'edn-query-language.core)
        ((requiring-resolve 'shadow.cljs.devtools.server/start!)))
      sys)))

macrobartfast05:03:48

yeah... that's what made me think I wouldn't be able to just jack in, as it were...

dpsutton05:03:06

here's all the code in biff that does this stuff. so you need to smuggle all your middleware down through to here, etc

blak3mill3r05:03:37

I have discovered something... I know why it complained about middleware not found when I started ./task dev

dpsutton05:03:55

#:biff{:first-start first-start
       :routes routes
       :static-pages pages
       :event-handler #(api % (:?data %))
       :rules #'rules
       :triggers #'triggers
       :jobs jobs
       :send-email #'send-email
       :after-refresh `after-refresh}
and here's the knobs you have to thread all that stuff down

blak3mill3r05:03:03

it's because, shadow-cljs.edn has :deps {:aliases [:cljs]} in it and that is an alias I have defined globally

dpsutton05:03:34

nah its because of this line from above: (nrepl/start-server :port 7888) no way to get middleware into there

blak3mill3r05:03:55

isn't there ... an edn file

blak3mill3r05:03:07

yeah there is

blak3mill3r05:03:12

cat ~/.nrepl/nrepl.edn 
;; can be overridden locally with .nrepl.edn ... which replaces (not merges) those here
{:bind "localhost"
 :middleware [cider.nrepl/cider-middleware
              #_cider.piggieback/wrap-cljs-repl
              refactor-nrepl.middleware/wrap-refactor]}

dpsutton05:03:53

oh yeah. i hate the idea of globally defined files for this stuff. that's system wide and expects random projects to have those deps

blak3mill3r05:03:12

I mean, I agree with @dpsutton in spirit... I don't like too much magic around starting the system

dpsutton05:03:13

so many issues from old profiles.clj people have laying around

blak3mill3r05:03:22

but I still think I can make this biff + cider thing work with what's there

macrobartfast05:03:34

I understand where you're coming from, @dpsutton.

dpsutton05:03:52

but anyways, this is all designed if just connect to an nrepl port with no other requirements. cider will be very neutered in this thing.

macrobartfast05:03:02

This project is an effort to get a more turn-key thing going for people, but it fairly bound to a specific editor, at the moment, it seems, at least for inline eval'ing.

macrobartfast05:03:16

This has exposed my lack of comprehension of cider and figwheel in general... which is a good thing.

macrobartfast05:03:42

It's probably time for me to finally put more effort into understanding the repl magic I like so much.

macrobartfast05:03:43

I kind of understood things when figwheel first came out (yay, flappy bird)... but things got increasingly complex for me to grok.

blak3mill3r06:03:14

So... while I am not sure exactly which features of cider+figwheel you loved, I want to point out that shadow-cljs is a very different way of working with clojurescript; I have not yet tried it, but I suspect that dpsutton is correct that a ton of useful CIDER stuff will be missing

blak3mill3r06:03:36

it sounds like you can get some of the same features (live cljs recompilation, cljs repl)

macrobartfast06:03:01

gotcha... mainly, I like being able to hit a db from within the code...

macrobartfast06:03:13

as well as atoms...

blak3mill3r06:03:22

hit a db ... from jvm clojure right?

macrobartfast06:03:29

so I can refine my functions.

macrobartfast06:03:47

Well, db from Clojure, atoms and remote calls from ClojureScript.

macrobartfast06:03:32

That's my general use, anyway.

blak3mill3r06:03:44

then you wont miss the rest of the CIDER features

blak3mill3r06:03:52

I am still fiddling about

macrobartfast06:03:56

I'd be cool probably without them.

blak3mill3r06:03:07

thus far I have not gotten biff to start and have cider middleware

macrobartfast06:03:23

ok... massive gratitude, btw...

blak3mill3r06:03:23

biff does look interesting... it is far from the way I am used to working with clojurescript though

macrobartfast06:03:56

Biff is a cool project in general, and so if I can get it to work I learn all about crux and so on, the things baked into the framework.

macrobartfast06:03:46

It also allows you to deploy a site to the very affordable Digital Ocean very quickly with a lot of features I want in a basic project... and I like to experiment so it's appealing.

blak3mill3r06:03:29

ooh it uses crux? very cool

blak3mill3r06:03:09

well I got a cider+piggieback cljs repl working in emacs with my biff project ... but I'm not there yet

macrobartfast06:03:24

I'm as excited as a pomeranian on the back dash of a car who's just spotted its owner come out of a donut shop.

blak3mill3r06:03:26

unfortunately I think what I've done is not compatible with the way biff starts the repl though

blak3mill3r06:03:54

oddly it sounds like piggieback + shadow-cljs is not really a thing, even though the vim-fireplace code supposedly supports converting to a cljs repl with shadow-cljs, and calls this feature :Piggieback ... I think the relationship is in name only

blak3mill3r06:03:32

@macrobartfast do you know if anybody is using biff without shadow-cljs?

macrobartfast06:03:41

I don't think anyone is.

macrobartfast06:03:50

I don't know, really...

macrobartfast06:03:01

but it's a fairly new project.

blak3mill3r06:03:33

it is possible that the Right Way to accomplish this (cider+biff) is to provide an alternative that starts nREPL with cider middleware and then uses piggieback to turn it into a cljs repl

macrobartfast06:03:58

the framework creator would probably be super down for that...

blak3mill3r06:03:01

that is going to have the advantage of supporting all the amazing CIDER features;

macrobartfast06:03:13

they indicated curiosity about Emacs in general.

blak3mill3r06:03:38

the thing is, the selling points of shadow-cljs don't apply to everyone... this is the kind of thing that makes designing opinionated frameworks extremely challenging

blak3mill3r06:03:59

I mean I have always loved using figwheel and piggieback, and didn't mind that it was running JVM clojure for the cljs compilation. I am not an expert on shadow-cljs at all, but IIUC it is using the self-hosted CLJS compiler

macrobartfast06:03:00

well, the framework touches on one of the Clojure conundrums in general... how to get a greenfield project up and deployed with usual features in a short amount of time...

macrobartfast06:03:50

and I guess I would go to another language for that sort of situation... but, of course, I'm not going to for all the reasons none of us would.

blak3mill3r06:03:23

nah I must be wrong about that... clearly shadow-cljs is starting a clojure process here

blak3mill3r06:03:28

I don't see anything fundamentally wrong with the idea of having another way to start biff that uses piggieback. I was able to make it work (but not loading the actual biff app's cljs sources)

blak3mill3r06:03:52

I mean, I created a biff project, added the necessary middleware, and then I was able to get piggieback to work compiling something in the context of that project

blak3mill3r06:03:11

that is really far from the way biff has it working though, with shadow-cljs

macrobartfast06:03:17

pomeranian actually shatters rear windshield

❤️ 1
blak3mill3r06:03:36

https://github.com/tpope/vim-fireplace/issues/322 refers to some CIDER doc that says that shadow-cljs provides its own middleware so maybe I am going about this totally the wrong way trying to use piggieback

macrobartfast06:03:57

omg this is all deep... reading that now.

blak3mill3r06:03:17

I do actually see some evidence that biff without shadow-cljs might be a thing already

macrobartfast06:03:36

I just asked the Biff main author about this.

blak3mill3r06:03:51

it seems like maybe the biff SPA only knows how to compile the cljs using shadow-cljs though

macrobartfast06:03:11

biff.core/default-mpa-components…

macrobartfast06:03:01

:biff/start-shadow...

blak3mill3r06:03:51

yeah I found that

blak3mill3r06:03:04

but without shadow, there's no clojurescript compiler included, unless I am missing something

blak3mill3r06:03:23

however I did just get a cljs repl buffer in emacs that was connected to the browser which had my biff app loaded

blak3mill3r06:03:50

but wasn't able to get my emacs clojurescript-mode buffers to eval over this connection

macrobartfast06:03:56

I had a cljs repl... but I don't know if it was browser based... js/alert never worked IIRC

blak3mill3r06:03:47

I have used cider-connect-cljs and connected successfully to the nREPL server started by ./task dev which is launching shadow-cljs

blak3mill3r07:03:02

so I have a cider-repl buffer in emacs, in which (js/alert 1) works

blak3mill3r07:03:06

with the biff app in the browser

blak3mill3r07:03:11

this is pretty close to what you want

blak3mill3r07:03:18

but not quite

blak3mill3r07:03:42

I don't understand yet why the clojurescript-mode buffer is not sesman-linked with the cljs repl connection

macrobartfast07:03:12

googling sesman

blak3mill3r07:03:25

an emacs dependency of cider

blak3mill3r07:03:40

which allows it to have multiple nrepl connections simultaneously, and each buffer associated with one of them

blak3mill3r07:03:07

this is where the forms go when you cider-eval-last-defun for example (for each buffer, sesman associates it with an nrepl connection)

blak3mill3r07:03:26

it seems like it should've been associated after I got cider-connect-cljs to work

blak3mill3r07:03:33

with the shadow-cljs option (`:app`)

blak3mill3r07:03:48

but it aint yet 😢

macrobartfast07:03:18

all I wanted was a Pepsi.

macrobartfast07:03:50

perusing that.

macrobartfast07:03:27

are you trying those newer versions?

blak3mill3r07:03:38

bummer ... the symptom I am seeing now is identical to that person in the slack archive

blak3mill3r07:03:34

I wanted to update the versions but ran into some troubles; there is presumably a transitive dependency on clojure/clojurescript from either shadow-cljs or from biff itself

macrobartfast07:03:47

I am cleaning up my shadow-cljs situation... turns out I didn't have a top level shadow-cljs.edn, for starters...

blak3mill3r07:03:54

anyway that version mentioned in the slack archive as "fixing" (somewhat mysteriously) the issue is old-ish today

blak3mill3r07:03:14

I don't have a top-level shadow-cljs.edn either

macrobartfast07:03:35

I had one in my Documents folder, lol, from another project.

macrobartfast07:03:45

I am learning a ton right now.

macrobartfast07:03:14

ok, have a js/alert working from the cljs repl now myself, which is progress.

blak3mill3r07:03:02

it seems like it is very very close to working, my own cider-repl buffer that came from cider-connect-cljs to the shadow-cljs nrepl is stuck in a state pending-cljs (even though it is clearly sending code to the browser itself, this prevents cider-eval-* from working in clojurescript-mode buffers)

macrobartfast07:03:04

that, after putting in a global shadow-cljs.edn in ~/.shadow-cljs/config.edn with the most recent cider-nrepl version.

blak3mill3r07:03:26

makes sense, that's something like what I did

macrobartfast07:03:36

I have had that pending-cljs message too.

blak3mill3r07:03:53

track-state middleware...

macrobartfast07:03:32

"Also - are all of you using the latest piggieback?"

blak3mill3r07:03:35

your pomeranian is gonna love this

blak3mill3r07:03:51

try the following

blak3mill3r07:03:09

eval this elisp (setq cider-repl-auto-detect-type nil)

blak3mill3r07:03:27

then with your pending-cljs repl active

blak3mill3r07:03:43

execute cider-set-repl-type and choose cljs

blak3mill3r07:03:51

it is working for me

blak3mill3r07:03:14

cider docs say this can happen "in rare cases such as a bug in shadow-cljs" (paraphrased)

blak3mill3r07:03:05

the reality is that whatever the track-state middleware is supposed to do to allow cider to detect that the repl has become a cljs repl is broken (perhaps the way biff is running shadow-cljs simply does not load the track-state middleware, or it could be that it loads it in the wrong order, etc)

blak3mill3r07:03:31

but now I have cider+biff with cljs cider-eval-* and hot compilation of clojurescript (a la figwheel)

macrobartfast07:03:36

died. applying defibrillation paddles. back.

blak3mill3r07:03:48

drink some cider

blak3mill3r07:03:11

and Don't Panic

macrobartfast07:03:08

I've dodged the Vim bullet, again.

macrobartfast07:03:28

well, I do use evil mode in emacs, but don't tell anyone.

blak3mill3r07:03:23

a ton of people do... I used vim for 12 years and before I switched to emacs

blak3mill3r07:03:47

you should make sure to write down how we got it working

macrobartfast07:03:16

This was epic. I am copying this entire session and having it engraved on a palladium plate.

blak3mill3r07:03:21

I myself am a little tired and forgetful, though I think I know which bits were essential to my poking about

macrobartfast07:03:40

I'm keeping it all. Because next week I'll be right at the start of it again.

macrobartfast07:03:10

two palladium plates... one for launching beyond our solar system.

macrobartfast07:03:40

I'm sure they'll be able to puzzle out our entire planet by studying that.

macrobartfast07:03:21

good lord, so grateful.

macrobartfast07:03:49

super excited to dive into the various parts of this framework now (crux, etc).

blak3mill3r07:03:13

some cider features don't work...

blak3mill3r07:03:43

TBH it's been a while since I clojurescripted and I am not sure how much of this is because it's using shadow-cljs ...

blak3mill3r07:03:57

but the basics work nicely, which is what you wanted!

macrobartfast07:03:05

it's exactly what I wanted.

macrobartfast07:03:19

I use very few features (unfortunately)...

macrobartfast07:03:27

but here the ignorance is an asset.

blak3mill3r07:03:38

haha, I'm glad I could help!

macrobartfast07:03:51

I am ridiculously glad you could.

blak3mill3r07:03:24

I am pretty sure I had cider-inspect working with cljs at some point and it is a nice feature, which it seems that the shadow-cljs nREPL server doesn't support even though the cider middleware is loaded

macrobartfast07:03:18

I'm always on the verge of giving up software altogether, then an awesome person like you or @dpsutton or some other kind soul will step in and get my boat pointed in the right direction again.

macrobartfast07:03:30

So thank you again.

blak3mill3r08:03:05

essentially it says that the way shadow-cljs works this way at all (i.e. without piggieback) is by emulating (some of) piggieback

blak3mill3r08:03:36

oh @macrobartfast I just noticed one other potential snag for people trying to use biff with cider+nrepl ... I had a global ~/.nrepl/nrepl.edn file configuring the cider.nrepl/cider-middleware and this appears to break whatever auto-configuration shadow-cljs is doing when it detects that cider-nrepl is on the classpath (as described here: https://shadow-cljs.github.io/docs/UsersGuide.html#nREPL) That is, biff's shadow-cljs nREPL ONLY loads the cider middleware if I remove that ~/.nrepl/nrepl.edn file (which a lot of nrepl users will probably have lying around)

macrobartfast08:03:34

ok... so many gotchas.

thheller08:03:39

I'm happy to remove gotchas when someone tells me about them. I don't use cider-nrepl personally so I'm not aware of any issues it may have with shadow-cljs unless someone tells me.

dpsutton17:03:33

this is all from trying to use biff, which tries to helpfully start everything up and prevents us from putting the necessary dependencies in place. its a bit like lein-shadow where it's trying to be helpful and that means its not super helpful

macrobartfast19:03:44

I understand... my 'gotchas' was mainly about the whole process of getting biff to work in my setup...

macrobartfast19:03:04

hopefully when my knowledge increases I might be able to contribute to biff by helping to make a startup option that would enable easier use with Emacs... or at least that seemed like an option that would work...

macrobartfast19:03:05

for someone like me biff offers a ton of value in being an integrated working system... I can see how all the parts fit together.

macrobartfast19:03:48

not to mention speed of deployment of ideas I want to explore. But I understand the tradeoffs of any integrated system.

macrobartfast08:03:45

Totally... and no one could anticipate the issues from all the combinatorial possibilities of all the parts.

macrobartfast08:03:23

What's crazy to me is how often this all just works.