Skip to content

cider-connect-cljs: (void-function :number) #2975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
manuel-uberti opened this issue Jan 28, 2021 · 2 comments
Closed

cider-connect-cljs: (void-function :number) #2975

manuel-uberti opened this issue Jan 28, 2021 · 2 comments

Comments

@manuel-uberti
Copy link
Contributor

manuel-uberti commented Jan 28, 2021

Expected behavior

C-c M-C lets me connect to an external and running shadow-cljs watch.

Actual behavior

Debugger entered--Lisp error: (void-function :number)
  :number(0)
  parseclj-lex--leaf-token-value(((:token-type . :keyword) (:form . ":builds") (:pos . 2)))
  (cons (parseclj-lex--leaf-token-value token) stack)
  (if (member (parseclj-lex-token-type token) (list :whitespace :comment)) stack (cons (parseclj-lex--leaf-token-value token) stack))
  parseedn-reduce-leaf((((:token-type . :lbrace) (:form . "{") (:pos . 1))) ((:token-type . :keyword) (:form . ":builds") (:pos . 2)) ((:tag-readers (shadow/env . identity))))
  funcall(parseedn-reduce-leaf (((:token-type . :lbrace) (:form . "{") (:pos . 1))) ((:token-type . :keyword) (:form . ":builds") (:pos . 2)) ((:tag-readers (shadow/env . identity))))
  (setq stack (funcall reduce-leaf stack token options))
  (cond ((parseclj-lex-leaf-token-p token) (setq stack (funcall reduce-leaf stack token options))) ((parseclj-lex-closing-token-p token) (setq stack (parseclj--reduce-coll stack token reduce-branch options))) (t (setq stack (cons token stack))))
  (while (not (or (and read-one (parseclj-single-value-p stack value-p)) (eq (parseclj-lex-token-type token) :eof))) (if (and fail-fast (parseclj-lex-error-p token)) (progn (parseclj--error "Invalid token at %s: %S" (a-get token :pos) (parseclj-lex-token-form token)))) (cond ((parseclj-lex-leaf-token-p token) (setq stack (funcall reduce-leaf stack token options))) ((parseclj-lex-closing-token-p token) (setq stack (parseclj--reduce-coll stack token reduce-branch options))) (t (setq stack (cons token stack)))) (let* ((top-value (parseclj--take-value stack value-p)) (opening-token (parseclj--take-token (nthcdr (length top-value) stack) value-p parseclj-lex--prefix-tokens)) new-stack) (while (and top-value opening-token) (setq new-stack (nthcdr (+ (length top-value) (length opening-token)) stack)) (setq stack (funcall reduce-branch new-stack (car opening-token) (append (cdr opening-token) top-value) options)) (setq top-value (parseclj--take-value stack value-p)) (setq opening-token (parseclj--take-token (nthcdr (length top-value) stack) value-p parseclj-lex--prefix-tokens)))) (let* ((top-value-1 (parseclj--take-value stack value-p)) (top-value-2 (parseclj--take-value (nthcdr (length top-value-1) stack) value-p)) (opening-token (parseclj--take-token (nthcdr (+ (length top-value-1) (length top-value-2)) stack) value-p parseclj-lex--prefix-2-tokens)) new-stack) (while (and top-value-1 top-value-2 opening-token) (setq new-stack (nthcdr (apply #'+ (mapcar #'length (list top-value-1 top-value-2 opening-token))) stack)) (setq stack (funcall reduce-branch new-stack (car opening-token) (append (cdr opening-token) top-value-2 top-value-1) options)) (setq top-value-1 (parseclj--take-value stack value-p)) (setq top-value-2 (parseclj--take-value (nthcdr (length top-value-1) stack) value-p)) (setq opening-token (parseclj--take-token (nthcdr (+ (length top-value-1) (length top-value-2)) stack) value-p parseclj-lex--prefix-2-tokens)))) (setq token (parseclj-lex-next)))
  (let ((fail-fast (a-get options :fail-fast t)) (read-one (a-get options :read-one)) (value-p (a-get options :value-p #'(lambda (e) (not (parseclj-lex-token-p e))))) (stack nil) (token (parseclj-lex-next))) (while (not (or (and read-one (parseclj-single-value-p stack value-p)) (eq (parseclj-lex-token-type token) :eof))) (if (and fail-fast (parseclj-lex-error-p token)) (progn (parseclj--error "Invalid token at %s: %S" (a-get token :pos) (parseclj-lex-token-form token)))) (cond ((parseclj-lex-leaf-token-p token) (setq stack (funcall reduce-leaf stack token options))) ((parseclj-lex-closing-token-p token) (setq stack (parseclj--reduce-coll stack token reduce-branch options))) (t (setq stack (cons token stack)))) (let* ((top-value (parseclj--take-value stack value-p)) (opening-token (parseclj--take-token (nthcdr (length top-value) stack) value-p parseclj-lex--prefix-tokens)) new-stack) (while (and top-value opening-token) (setq new-stack (nthcdr (+ (length top-value) (length opening-token)) stack)) (setq stack (funcall reduce-branch new-stack (car opening-token) (append (cdr opening-token) top-value) options)) (setq top-value (parseclj--take-value stack value-p)) (setq opening-token (parseclj--take-token (nthcdr (length top-value) stack) value-p parseclj-lex--prefix-tokens)))) (let* ((top-value-1 (parseclj--take-value stack value-p)) (top-value-2 (parseclj--take-value (nthcdr (length top-value-1) stack) value-p)) (opening-token (parseclj--take-token (nthcdr (+ ... ...) stack) value-p parseclj-lex--prefix-2-tokens)) new-stack) (while (and top-value-1 top-value-2 opening-token) (setq new-stack (nthcdr (apply #'+ (mapcar ... ...)) stack)) (setq stack (funcall reduce-branch new-stack (car opening-token) (append (cdr opening-token) top-value-2 top-value-1) options)) (setq top-value-1 (parseclj--take-value stack value-p)) (setq top-value-2 (parseclj--take-value (nthcdr (length top-value-1) stack) value-p)) (setq opening-token (parseclj--take-token (nthcdr (+ ... ...) stack) value-p parseclj-lex--prefix-2-tokens)))) (setq token (parseclj-lex-next))) (if fail-fast (progn (let* ((token (and t (seq-find ... stack)))) (if token (parseclj--error "At position %s, unmatched %S" (a-get token :pos) (parseclj-lex-token-type token)) nil)))) (if read-one (car (parseclj--take-value stack value-p)) (car (funcall reduce-branch nil (parseclj-lex-token :root "" 1) (reverse stack) options))))
  parseclj-parser(parseedn-reduce-leaf parseedn-reduce-branch ((:tag-readers (shadow/env . identity))))
  parseedn-read(((shadow/env . identity)))
  (car (parseedn-read '((shadow/env . identity))))
  (let ((hash (car (parseedn-read '((shadow/env . identity)))))) (cider--shadow-parse-builds hash))
  (progn (insert-file-contents shadow-edn) (let ((hash (car (parseedn-read '(...))))) (cider--shadow-parse-builds hash)))
  (unwind-protect (progn (insert-file-contents shadow-edn) (let ((hash (car (parseedn-read '...)))) (cider--shadow-parse-builds hash))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents shadow-edn) (let ((hash (car (parseedn-read ...)))) (cider--shadow-parse-builds hash))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents shadow-edn) (let ((hash (car ...))) (cider--shadow-parse-builds hash))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (progn (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents shadow-edn) (let ((hash ...)) (cider--shadow-parse-builds hash))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  (if (file-exists-p shadow-edn) (progn (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents shadow-edn) (let (...) (cider--shadow-parse-builds hash))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))))
  (let ((shadow-edn (concat (clojure-project-dir) "shadow-cljs.edn"))) (if (file-exists-p shadow-edn) (progn (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents shadow-edn) (let ... ...)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))))
  cider--shadow-get-builds()
  (completing-read "Select shadow-cljs build: " (cider--shadow-get-builds))
  (or cider-shadow-default-options (car cider-shadow-watched-builds) (completing-read "Select shadow-cljs build: " (cider--shadow-get-builds)))
  (cider-normalize-cljs-init-options (or cider-shadow-default-options (car cider-shadow-watched-builds) (completing-read "Select shadow-cljs build: " (cider--shadow-get-builds))))
  (let* ((shadow-require "(require '[shadow.cljs.devtools.api :as shadow])") (default-build (cider-normalize-cljs-init-options (or cider-shadow-default-options (car cider-shadow-watched-builds) (completing-read "Select shadow-cljs build: " (cider--shadow-get-builds))))) (watched-builds (or (mapcar #'cider-normalize-cljs-init-options cider-shadow-watched-builds) (list default-build))) (watched-builds-form (mapconcat #'(lambda (build) (format "(shadow/watch %s)" build)) watched-builds " ")) (user-build-form "(do %s %s (shadow/nrepl-select %s))") (default-build-form "(do %s (shadow/%s))")) (if (member default-build '(":browser-repl" ":node-repl")) (format default-build-form shadow-require (string-remove-prefix ":" default-build)) (format user-build-form shadow-require watched-builds-form default-build)))
  cider-shadow-cljs-init-form()
  funcall(cider-shadow-cljs-init-form)
  (if (symbolp repl-form) (funcall repl-form) repl-form)
  (if repl-form (if (symbolp repl-form) (funcall repl-form) repl-form) (user-error "No ClojureScript REPL type %s found.  Please make ..." repl-type))
  (let* ((repl-form (and t (car (cdr (seq-find #'... cider-cljs-repl-types)))))) (if repl-form (if (symbolp repl-form) (funcall repl-form) repl-form) (user-error "No ClojureScript REPL type %s found.  Please make ..." repl-type)))
  cider-cljs-repl-form(shadow)
  (let* ((cljs-type (plist-get params :cljs-repl-type)) (repl-init-form (cider-cljs-repl-form cljs-type))) (plist-put (plist-put params :repl-init-function #'(lambda nil (cider--check-cljs cljs-type) (set (make-local-variable 'cider-cljs-repl-type) cljs-type) (cider-nrepl-send-request (list "op" "eval" "ns" (cider-current-ns) "code" repl-init-form) (cider-repl-handler (current-buffer))) (if (and (buffer-live-p nrepl-server-buffer) cider-offer-to-open-cljs-app-in-browser) (progn (cider--offer-to-open-app-in-browser nrepl-server-buffer))))) :repl-init-form repl-init-form))
  (save-current-buffer (set-buffer (or (plist-get params :--context-buffer) (current-buffer))) (let* ((cljs-type (plist-get params :cljs-repl-type)) (repl-init-form (cider-cljs-repl-form cljs-type))) (plist-put (plist-put params :repl-init-function #'(lambda nil (cider--check-cljs cljs-type) (set (make-local-variable ...) cljs-type) (cider-nrepl-send-request (list "op" "eval" "ns" ... "code" repl-init-form) (cider-repl-handler ...)) (if (and ... cider-offer-to-open-cljs-app-in-browser) (progn ...)))) :repl-init-form repl-init-form)))
  cider--update-cljs-init-function((:project-dir "~/7bridges/skuro/cockpit/" :host "localhost" :port 8777 :cljs-repl-type shadow))
  (plist-put (cider--update-cljs-init-function (cider--update-cljs-type (cider--check-existing-session (cider--update-host-port (cider--update-project-dir params))))) :session-name nil)
  (plist-put (plist-put (cider--update-cljs-init-function (cider--update-cljs-type (cider--check-existing-session (cider--update-host-port (cider--update-project-dir params))))) :session-name nil) :repl-type 'pending-cljs)
  (cider-nrepl-connect (plist-put (plist-put (cider--update-cljs-init-function (cider--update-cljs-type (cider--check-existing-session (cider--update-host-port (cider--update-project-dir params))))) :session-name nil) :repl-type 'pending-cljs))
  cider-connect-cljs(nil)
  funcall-interactively(cider-connect-cljs nil)
  call-interactively(cider-connect-cljs nil nil)
  command-execute(cider-connect-cljs)

Steps to reproduce the problem

  • Run npx shadow-cljs watch [build] in a CLJS project (e.g., using boodle you'd run npx shadow-cljs watch :boodle)
  • From a CLJS buffer inside your project, hit C-c M-C
  • Select localhost and hit RET
  • Type the the port number you specified in your shadow-cljs.edn file (e.g., using boodle it would be 8777) and hit RET
  • Select shadow as ClojureScript REPL type and hit RET

Environment & Version information

CIDER version information

;; CIDER 1.1.0snapshot, nREPL 0.8.3
;; Clojure 1.10.1, Java 11.0.9.1

Lein/Boot version

I am using just a deps.edn file, but I am using shadow-cljs 2.11.15.

System information

GNU Emacs 28.0.50

➤ Master branch commit:
   e4c667079086528c6e0a9eead9c2d4d5f5b7c6e1
   Fix Gnus icalendar button navigation

➤ Configured with the following options:
   --with-harfbuzz
   --with-json
   --with-mailutils

➤ Configured with the following features:
   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM
   GSETTINGS GTK3 HARFBUZZ INOTIFY JPEG JSON LCMS2 LIBOTF LIBSELINUX
   LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY PDUMPER PNG RSVG SOUND
   THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM ZLIB

➤ Running on:
   Ubuntu 20.04 LTS
   GNOME Shell 3.36.4 (x11)
   GTK+ Version 3.24.18, cairo version 1.16.0
@manuel-uberti
Copy link
Contributor Author

One note: this happens from emacs -Q as well.

@manuel-uberti
Copy link
Contributor Author

This is a duplicate of #2967

Rebuilding parseclj fixes it. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant