Fork me on GitHub
#cider
<
2020-06-29
>
euccastro03:06:04

when I cider-jack-in-clj+cljs into a figwheel-main project and try and reload namespaces with clojure.tools.namespace.repl/refresh (http://e.g.as triggered by integrant.repl/reset) I get the following exception:

[{:type clojure.lang.Compiler$CompilerException
   :message "Syntax error compiling at (figwheel/repl.cljc:1372:5)."
   :data #:clojure.error{:phase :compile-syntax-check, :line 1372, :column 5, :source "figwheel/repl.cljc"}
   :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 7115]}
  {:type java.lang.ClassNotFoundException
   :message "cljs.stacktrace"
   :at [java.net.URLClassLoader findClass "URLClassLoader.java" 471]}]

euccastro04:06:41

this doesn't happen if I cider-jack-in-clj and cider-jack-in-cljs separately. is cider-jack-in-clj+cljs not recommended for figwheel-main if you're going to use clojure.tools.namespace.repl/refresh? am I missing out on anything by not being able to use the same session for both?

euccastro05:06:23

just in case someone else runs into the same problem, I worked around it by restricting the set of directories that clojure.tools.namespace.repl/refresh will traverse (a good idea anyway):

(ns user
  (:require
   [clojure.java.classpath :as cp]
   [clojure.string :as str]
   [clojure.tools.namespace.repl :as nsrepl]))

(apply nsrepl/set-refresh-dirs
       (for [root (cp/classpath-directories)
             :when (and (or (str/starts-with? root "dev/")
                            (str/starts-with? root "src/"))
                        (not (str/includes? root "/cljs/"))
                        (not (str/ends-with? root "/cljs")))
             f (file-seq root)
             :when (.isDirectory f)]
         f))

euccastro05:06:31

(don't C+P this code blindly since it's tailored to the directory structure of my project; the important part is filtering out cljs directories)

strsnd09:06:43

Hello! What is an idiomatic way to limit the amount of printing of exceptions that reach the cider repl from other threads? I can use alter-var-root to make them restrict print-length as well but is there a better way?

jumar10:06:27

Isn’t that done by your logging framework?

strsnd11:06:47

Unfortunately it is not a thread creation I have under control

strsnd11:06:08

In theory it should be - yes.

jumar11:06:53

But you should have your logging under control- so you can limit or filter certain messages

strsnd11:06:47

Right, for a sensible application I would do it, but it is troublesome while just prototyping things in the REPL.

practicalli_john18:06:07

@dpsutton I updated the reference page for CIDER configuration variables, adding the descriptions https://practicalli.github.io/spacemacs/reference/cider/configuration-variables.html

dpsutton18:06:59

did you try running that script again?

practicalli_john20:06:53

I used the output you posted in slack and a bit of vim editing magic. I tightened up the wording a little in places

dpsutton18:06:09

that is awesome!