felipeochoa / rjsx-mode

A JSX major mode for Emacs
https://github.com/felipeochoa/rjsx-mode
MIT License
641 stars 32 forks source link

Error in menu-bar-update-hook and timer js2-mode-idle-reparse #76

Closed LaloHao closed 6 years ago

LaloHao commented 6 years ago

Error in menu-bar-update-hook (imenu-update-menubar): (wrong-type-argument js2-node [cl-struct-rjsx-identifier 60 1039 8 nil nil nil #s(js2-name-node 39 1039 8 nil nil "Provider" nil)])

Error running timer ‘js2-mode-idle-reparse’: (wrong-type-argument js2-node [cl-struct-rjsx-identifier 60 1039 8 nil nil nil #s(js2-name-node 39 1039 8 nil nil "Provider" nil)])

Mode fails to load when jsx tags are present (no highlights, no ast parse apparently), this happened since i updated all my packages with M-x package-list-packages U x.

If the file is plain js it works fine.

This doesn't happen with js2-jsx-mode

Trying C-u C-M-x on function rjsx-mode doesn't trigger edebug, how can i help?

LaloHao commented 6 years ago

Debugging js2-mode-idle-reparse does return something

Minimal file

class Random {
  fn() {
    return (
      <jsx></jsx>
    )
  }
}
Debugger entered--Lisp error: (wrong-type-argument js2-node #s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil)))
  apply(debug error (wrong-type-argument js2-node #s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil))))
  edebug(error (wrong-type-argument js2-node #s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil))))
  signal(wrong-type-argument (js2-node #s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil))))
  edebug-signal(wrong-type-argument (js2-node #s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil))))
  signal(wrong-type-argument (js2-node #s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil))))
  js2-fixup-starts(#s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil)) (#s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil)))
  js2-node-add-children(#s(rjsx-identifier :type 60 :pos 120490 :len 5 :props nil :parent nil :namespace nil :name #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil)) #s(js2-name-node :type 39 :pos 120490 :len 5 :props nil :parent nil :name "count" :scope nil))
  rjsx-parse-identifier(rjsx-tag)
  rjsx-parse-member-or-ns(rjsx-tag)
  rjsx-parse-xml()
  rjsx-parse-top-xml()
  rjsx-parse-xml-initializer(#f(compiled-function () #<bytecode 0x40b7ba29>))
  apply(rjsx-parse-xml-initializer #f(compiled-function () #<bytecode 0x40b7ba29>) nil)
  js2-parse-xml-initializer()
  js2-parse-unary-expr()
  js2-parse-expon-expr()
  js2-parse-mul-expr()
  js2-parse-add-expr()
  js2-parse-shift-expr()
  js2-parse-rel-expr()
  js2-parse-eq-expr()
  js2-parse-bit-and-expr()
  js2-parse-bit-xor-expr()
  js2-parse-bit-or-expr()
  js2-parse-and-expr()
  js2-parse-or-expr()
  js2-parse-cond-expr()
  js2-parse-assign-expr()
  js2-parse-argument-list()
  js2-parse-function-call(#s(js2-name-node :type 39 :pos 0 :len 4 :props nil :parent #s(js2-call-node :type 38 :pos 120482 :len 1 :props nil :parent nil :target #1 :args nil :lp 5 :rp nil) :name "when" :scope nil))
  js2-parse-member-expr-tail(t #s(js2-name-node :type 39 :pos 0 :len 4 :props nil :parent #s(js2-call-node :type 38 :pos 120482 :len 1 :props nil :parent nil :target #1 :args nil :lp 5 :rp nil) :name "when" :scope nil))
  js2-parse-member-expr(t)
  js2-parse-unary-expr()
  js2-parse-expon-expr()
  js2-parse-mul-expr()
  js2-parse-add-expr()
  js2-parse-shift-expr()
  js2-parse-rel-expr()
  js2-parse-eq-expr()
  js2-parse-bit-and-expr()
  js2-parse-bit-xor-expr()
  js2-parse-bit-or-expr()
  js2-parse-and-expr()
  js2-parse-or-expr()
  js2-parse-cond-expr()
  js2-parse-assign-expr()
  js2-parse-argument-list()
  js2-parse-function-call(#s(js2-error-node :type -1 :pos 0 :len 1 :props nil :parent #s(js2-call-node :type 38 :pos 120466 :len 1 :props nil :parent nil :target #1 :args nil :lp 15 :rp nil)))
  js2-parse-member-expr-tail(t #s(js2-error-node :type -1 :pos 0 :len 1 :props nil :parent #s(js2-call-node :type 38 :pos 120466 :len 1 :props nil :parent nil :target #1 :args nil :lp 15 :rp nil)))
  js2-parse-member-expr(t)
  js2-parse-unary-expr()
  js2-parse-expon-expr()
  js2-parse-mul-expr()
  js2-parse-add-expr()
  js2-parse-shift-expr()
  js2-parse-rel-expr()
  js2-parse-eq-expr()
  js2-parse-bit-and-expr()
  js2-parse-bit-xor-expr()
  js2-parse-bit-or-expr()
  js2-parse-and-expr()
  js2-parse-or-expr()
  js2-parse-cond-expr()
  js2-parse-assign-expr()
  js2-parse-expr()
  js2-parse-expr-stmt()
  js2-statement-helper()
  js2-parse-statement()
  js2-do-parse()
  js2-parse()
  js2-reparse()
  (edebug-after (edebug-before 6) 7 (js2-reparse))
  (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t))))))
  (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))
  (closure ((buffer . #<buffer js2-mode.el>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t))))))))()
  edebug-default-enter(js2-mode-idle-reparse (#<buffer js2-mode.el>) (closure ((buffer . #<buffer js2-mode.el>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))))
  edebug-default-enter(js2-mode-idle-reparse (#<buffer js2-mode.el>) (closure ((buffer . #<buffer js2-mode.el>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))))
  edebug-enter(js2-mode-idle-reparse (#<buffer js2-mode.el>) (closure ((buffer . #<buffer js2-mode.el>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))))
  js2-mode-idle-reparse(#<buffer js2-mode.el>)
  apply(js2-mode-idle-reparse #<buffer js2-mode.el>)
  timer-event-handler([t 0 0 0 nil js2-mode-idle-reparse (#<buffer js2-mode.el>) idle 0])
  recursive-edit()
  edebug--recursive-edit(before)
  edebug--display-1(nil 0 before)
  edebug--display(nil 0 before)
  edebug-debugger(0 before nil)
  edebug-before(0)
  (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))
  (closure ((buffer . #<buffer *scratch*<2>>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t))))))))()
  edebug-default-enter(js2-mode-idle-reparse (#<buffer *scratch*<2>>) (closure ((buffer . #<buffer *scratch*<2>>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))))
  edebug-default-enter(js2-mode-idle-reparse (#<buffer *scratch*<2>>) (closure ((buffer . #<buffer *scratch*<2>>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))))
  edebug-enter(js2-mode-idle-reparse (#<buffer *scratch*<2>>) (closure ((buffer . #<buffer *scratch*<2>>) t) nil (edebug-after (edebug-before 0) 18 (cond ((edebug-after (edebug-before 1) 5 (eq (edebug-after 0 2 buffer) (edebug-after (edebug-before 3) 4 (current-buffer)))) (edebug-after (edebug-before 6) 7 (js2-reparse))) ((edebug-after (edebug-before 8) 10 (buffer-live-p (edebug-after 0 9 buffer))) (edebug-after (edebug-before 11) 17 (save-current-buffer (set-buffer (edebug-after 0 12 buffer)) (edebug-after (edebug-before 13) 16 (add-hook 'window-configuration-change-hook (edebug-after (edebug-before 14) 15 (function js2-mode-idle-reparse-inner)) nil t)))))))))
  js2-mode-idle-reparse(#<buffer *scratch*<2>>)
  apply(js2-mode-idle-reparse #<buffer *scratch*<2>>)
  timer-event-handler([t 0 0 200000 nil js2-mode-idle-reparse (#<buffer *scratch*<2>>) idle 0])
LaloHao commented 6 years ago

My bad, i had switched to Emacs 27 and needed to recompile packages, also fixed flycheck

(byte-recompile-directory "~/.emacs.d/" nil 'force)

https://github.com/clojure-emacs/clj-refactor.el/issues/369#issuecomment-388326195