Fork me on GitHub
Sampo Toiva07:10:10

Hi, any idea on what might cause an error:

Error running hook "clj-refactor-mode" because: (error Given parent class xref-location is not a class)
When opening a .clj file. More specific stacktrace points that this comes from cider :
Debugger entered--Lisp error: (error "Given parent class xref-location is not a class")
  error("Given parent class %S is not a class" xref-location)
  eieio-defclass-internal(xref-etags-location (xref-location) ((tag-info :type list :initarg :tag-info) (file :type string :initarg :file :reader xref-location-group)) (:documentation "Location of an etags tag."))

Sampo Toiva09:10:48

Allright, recompiled everything and now I'm getting: Symbol's value as variable is void: xref-etags-location


Not really familiar with this stuff but either a require is missing or xref-etags-location does in fact not exist anymore? Sadly breaking changes aren't uncommon in .el libs 😞

Sampo Toiva10:10:45

Ok figured it out. I need to investigate a bit more but I'll write here a thorough explanation soon.

Sampo Toiva10:10:17

Ok, cider-common.el requires etags here: That's required only for function find-tag-marker-ring ( That's obsolete since emacs 25.1 , but I think finally emacs 28 removed it completely. The correct way should be, to my knowledge, to first (require 'xref) and then use xref-push-marker-stack instead of find-tag-marker-ring. Here's a similar issue in haskell-mode:


Sounds reasonable! GH issue appreciated

Sampo Toiva10:10:43

Yep, writing one.

Sampo Toiva10:10:28

I patched my own cider with those changes and things seem to work.


it lgtm but that's not my area of expertise either. Let's see if a reviewer pops up else feel free to bump the thread over gh.

Sampo Toiva18:10:21

Not my area of expertise either 😉 However, the code is essentially identical: • find-tag-marker-ring was a variable alias for xref--marker-ringxref-push-marker-stack is implemented as:

(defun xref-push-marker-stack (&optional m)
  "Add point M (defaults to `point-marker') to the marker stack."
  (ring-insert xref--marker-ring (or m (point-marker))))
• That's identical with the old code in cider-common (minus the optional m param)

👌 1
👏 1

does cljs-repl-type 'shadow actually work for people? I don't remember it ever working, and have always had a custom setup for it. This is what I get:

;; ClojureScript REPL type: shadow
;; ClojureScript REPL init form: (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/watch :main) (shadow/nrepl-select :main))
Execution error (ExceptionInfo) at shadow.cljs.devtools.server.runtime/get-instance! (runtime.clj:11).
shadow-cljs has not been started yet!
In embedded mode you need to call (shadow.cljs.devtools.server/start!) to start it.
If you have a shadow-cljs server or watch running then you are not connected to that process.


it also seems there's no built-in support for adding the shadow-cljs middleware? I feel like a jack-in-clj&cljs should just work at this point but it seems some key pieces are missing...


I should mention I'm using clojure-cli to start the process


It does. I’m guessing you are using deps edn with it?


There’s an issue that explains how the middleware can end up there.


you are saying it is supposed to work? because I don't find any mention in the cider code base of the shadow middleware


Got it to work by adding this:

(add-to-list 'cider-jack-in-nrepl-middlewares (list "shadow.cljs.devtools.server.nrepl/middleware"
                                                    :predicate #'cider--shadow-cljs-repl-p))

(defun cider--shadow-cljs-repl-p (_spec)
  (eq 'shadow cider-default-cljs-repl))
and adding a call to (shadow.cljs.devtools.server/start!) to the cljs repl init code. It seems the current code assumes that when cljs-repl-type is shadow, that your cider-preferred-build-tool is also shadow


ah that would be problematic