Fork me on GitHub
#cider
<
2019-07-01
>
carkh04:07:41

@oskarkv I tested pretty printing working a couple days ago with regular figwheel

carkh04:07:44

though it does not work with shadow-cljs, due to some trickery in shadow-cljs, maybe figwheel-main also replaces some of the nrepl stuff with its own ?

carkh04:07:01

in any event, make sure you have a recent everything, and that you're not plugging in some old nrepl via lein

carkh04:07:57

@oskarkv for the buffer loading, or defun evaling, I usually let figwheel/shadow-cljs do its job, and let it reload the file

carkh04:07:50

i didn't notice much missing messages, granted some stuff working with regular clojrue doesn't work with clojurescript, but the experience has generally been good

oskarkv04:07:59

Hm, I don't understand what you mean. Do its job?

carkh04:07:15

i save the file, figwheel reloads it

carkh04:07:45

evaling stuff in buffer has indeed been a bit fickle

carkh04:07:31

clojurescript is a different beast, it requires a bit of workflow fine tuning

oskarkv04:07:38

But I still don't see the errors produced by assert

oskarkv04:07:55

Or, messages

carkh04:07:23

indeed i see the same thing as you with figwheel

carkh04:07:00

evaling the assert form shows the error

carkh04:07:44

but not evaluating the buffer....now i'm curious, i've been using shadow-cljs these days

carkh04:07:45

this actually corrupted my figwheel connection it does not reload properly anymore !

carkh04:07:03

had to refresh the browser

carkh04:07:04

same problem in shadow-cljs, though this does not break the reloading there

carkh04:07:08

anyways good luck =)

carkh14:07:44

I want to change cider-ns-map from C-c M-n to C-c C-n, how can i do this ? And is there a good reason not to use this combination ?

carkh14:07:49

that's not a global-set-key thing is it ?

carkh14:07:34

maybe use define-key from a hook to cider-mode ?

carkh14:07:48

or local-set-key ... mhh there is a whole menagerie dedicated to this

yuhan14:07:35

(define-key cider-mode-map (kbd "C-c C-n") 'cider-ns-map)

yuhan14:07:11

you want to make sure it's only run after cider is loaded

yuhan14:07:23

so in the :config section if you're using use-package

carkh14:07:32

alright, i'll do just that

yuhan14:07:41

or wrap it in a (with-eval-after-load 'cider

carkh14:07:57

use-package so handy, thanks again

carkh14:07:44

works like a charm

oskarkv16:07:36

@dpsutton Sorry to bother you, but do you have any idea about those issues I wrote about above? Summarized here too https://www.reddit.com/r/Clojure/comments/c7l9h3/three_issues_with_cider_andor_clojurescript/

oskarkv16:07:33

I don't know if they are CIDER's fault and if I should create issues on github for them.

bozhidar17:07:25

> I want to change cider-ns-map from C-c M-n to C-c C-n, how can i do this ? And is there a good reason not to use this combination ?

bozhidar17:07:55

@carkh Just keep in mind that this overrides the command bound to C-c C-n. I guess you don’t use it, so than this is not a big deal for you.

bozhidar18:07:16

@oskarkv You could have also posted those as issues on GitHub (bigger chance that someone from our team will go over them). The pretty-printing not working really surprises me, as I can’t see a reason why it wouldn’t work with figwheel-main.

dpsutton18:07:40

@oskarkv i can look this evening. Can you give the smallest possible repo that i can clone to start investigating? Can much more easily investigate the bug if I don't have to create a similar figwheel main project, make a function that println logs and then throws an error, etc.

dpsutton04:07:56

hey oskarv, I've looked into it and I've got mixed results. The good thing is that this isn't bad behavior by CIDER because it exactly mimics what happens with cljs.main.

dpsutton04:07:01

[dan@fedora cljsissues]$ clj -m cljs.main -r
ClojureScript 1.10.520
cljs.user=> (require '[cljsissues.core])
nil
cljs.user=> cljsissues.core/something
nil
cljs.user=> (cljsissues.core/test-println)
Execution error (Error) at (<cljs repl>:1).
Cannot read property 'call' of undefined

cljs.user=> 

dpsutton04:07:06

so I tried your project with figwheel, the with just a bare browser repl with figwheel, and then finally with cljs.main above. It behaved identically every time. The assertion appeared in the browser and not the repl. The defs that occur after the throw expression are not interned

oskarkv18:07:29

What about the pretty printing?

dpsutton18:07:41

maybe raise in clojurescript channel? Not sure if known limitation or bug

dpsutton18:07:48

oh forgot to investigate

oskarkv18:07:03

I'll check out what happens with the last issue, printing first and then getting an error. And I'll open an issue on cider's github about the pretty printing

oskarkv18:07:25

Check it out with cljs.main i mean

oskarkv18:07:54

cljs.user=> (cljsissues.core/test-println)
testing println
Execution error () at (<cljs repl>:1).
null

cljs.user=> *e
"ERROR IN test-println"
It prints "testing println" when trying without CIDER, hm

oskarkv18:07:59

Hm, but that might be figwheel's fault

oskarkv18:07:44

No, happens in nashorn too

dpsutton18:07:10

cljs.main is the reference

dpsutton18:07:16

if it happens there it happens in clojurescript

oskarkv18:07:24

Yeah, but it doesn't happen in cljs.main. But then the problem might be in figwheel or cider, right?

oskarkv18:07:37

Anyway, I might have found a clue. If I try to print a lot, then I get the following error org.eclipse.jetty.websocket.api.MessageTooLargeException: Text message size [131072] exceeds maximum size [65536] Do you know anything about that?

oskarkv18:07:03

Seems to be from figwheel 😛

dpsutton19:07:47

👍 i'll look into it tonight. thanks for the repro

oskarkv19:07:09

Thank you!

theeternalpulse21:07:53

Is there a way when evaluating a namespace in cide rto also evaluate any required namespaces that may reside in the classpath if possible. for example if I jump into a some.namespace.core.spec file and it has a require for some.namespace.core , I first have to go in the core.clj and evaluate it first.

dpsutton21:07:16

how are you evaluating namespaces? It should work correctly by default

theeternalpulse21:07:46

I used cider-eval-ns-form

dpsutton21:07:53

if i hit cider-load-buffer (`C-c C-k`) it will do the right thing

theeternalpulse21:07:19

let me try it from scratch, I think i've seen the buffer work, thought ns would do the same

theeternalpulse21:07:49

buffer didn't either

theeternalpulse21:07:14

Could not locate dantheobserver/parrot_api/response__init.class,
   dantheobserver/parrot_api/response.clj or
   dantheobserver/parrot_api/response.cljc on classpath. Please check
   that namespaces with dashes use underscores in the Clojure file
   name.

dpsutton21:07:21

this sounds like you've got a classpath issue. maybe the file isn't where clojure thinks it should be?

theeternalpulse21:07:21

yeah I had to first load the other file first

dpsutton21:07:37

what's the file path to reponse.clj?

theeternalpulse21:07:29

/src/dantheobserver/parrot_api

theeternalpulse21:07:28

/home/theedeepee/projects/clojure/parrot-api.clj/src/dantheobserver/parrot_api:
  total used in directory 24 available 403486944
  drwxrwxr-x 2 theedeepee theedeepee 4096 Jul  1 14:24 .
  drwxrwxr-x 3 theedeepee theedeepee 4096 Jun 24 23:24 ..
  -rw-rw-r-- 1 theedeepee theedeepee 1033 Jun 30 10:30 app.clj
  -rw-rw-r-- 1 theedeepee theedeepee  547 Jun 28 20:30 common.clj
  -rw-rw-r-- 1 theedeepee theedeepee  526 Jun 26 07:45 response.clj
  -rw-rw-r-- 1 theedeepee theedeepee  378 Jul  1 14:24 response.spec.clj

dpsutton21:07:03

not sure. I cloned your repo. Jack in, C-c C-k from and then

theeternalpulse21:07:40

Ah, maybe it's because I run the nrepl alias

dpsutton21:07:54

what do you mean by that?

theeternalpulse21:07:20

I do clojure -A:nrepl and then do cider connect

theeternalpulse21:07:25

maybe connect doesn't evaluate the project

dpsutton21:07:05

i'm not sure "evaluate the project" is well defined. When nrepl starts up things are on the classpath but it hasn't evaluated the proejct

theeternalpulse21:07:36

hmm, It works with jack in, not sure why not with my deps.edn aliases

theeternalpulse21:07:53

if I run the application it finds everything fine with clojure -A:server

theeternalpulse21:07:03

so it's putting the right files in the classpath

dpsutton21:07:46

so the mystery deepens. Everything works correctly on your computer if you cider-jack-in but not if you CIDER connect to clojure -A:nrepl?

theeternalpulse21:07:39

well evaluating the files at least for development

theeternalpulse21:07:42

let me check the classpath

dpsutton21:07:49

try something for me. cider-jack-in (not cider-connect) and try opening the namespace. and then do m-x cider-load-buffer

theeternalpulse21:07:34

hmm my classpath is

dev
src
/home/theedeepee/.m2/repository/com/github/haifengl/smile-interpolation/1.5.2/smile-interpolation-1.5.2.jar
/home/theedeepee/.m2/repository/org/clojure/clojure/1.10.1-beta2/clojure-1.10.1-beta2.jar
/home/theedeepee/.m2/repository/org/apache/xmlgraphics/batik-dom/1.11/batik-dom-1.11.jar
/home/theedeepee/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
/home/theedeepee/.m2/repository/generateme/fastmath/1.2.0/fastmath-1.2.0.jar
/home/theedeepee/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar
...(other maven dependencies)

dpsutton21:07:00

what happened when you tried the steps i put above?

theeternalpulse21:07:31

I may have changes that aren't on your version

theeternalpulse21:07:43

this is all wrong, I'm leading you down the wrong path

theeternalpulse21:07:27

I was in the wrong project. I was wondering why dev showed up in my classpath when I didn't call it on -A:server

dpsutton21:07:35

haha that's a funny and understandable mistake 🙂 no worries

theeternalpulse21:07:03

I need to step away from the machine for a bit lol