Error when calling dap-ui-locals: (void-variable lsp-treemacs-generic-root)
bastianbeischer opened this issue ยท 16 comments
I am using latest treemacs from melpa. Backtrace:
Debugger entered--Lisp error: (void-variable lsp-treemacs-generic-root)
lsp-treemacs-render(((:label "Nothing to display..." :key "foo" :icon :empty)) " Locals " 1 "*dap-ui-locals*")
dap-ui-locals()
funcall-interactively(dap-ui-locals)
#<subr call-interactively>(dap-ui-locals record nil)
call-interactively@ido-cr+-record-current-command(#<subr call-interactively> dap-ui-locals record nil)
apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (dap-ui-locals record nil))
call-interactively(dap-ui-locals record nil)
command-execute(dap-ui-locals record)
execute-extended-command(nil "dap-ui-locals" nil)
funcall-interactively(execute-extended-command nil "dap-ui-locals" nil)
#<subr call-interactively>(execute-extended-command nil nil)
call-interactively@ido-cr+-record-current-command(#<subr call-interactively> execute-extended-command nil nil)
apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (execute-extended-command nil nil))
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
@bastianbeischer can you test after deleting elpa dir, restarting emacs, and installing the packages again? You may also test with M-x lsp-start-plain
Thanks, reinstalling made a difference, but now I get a different error:
Debugger entered--Lisp error: (wrong-type-argument listp lsp-treemacs-generic-root)
treemacs--find-custom-node((lsp-treemacs-generic-root "foo"))
treemacs-find-node((lsp-treemacs-generic-root "foo"))
treemacs--async-update-part-complete((lsp-treemacs-generic-root "foo") (lsp-treemacs-generic-root "foo") nil)
#f(compiled-function (items) #<bytecode -0x4d491a752017148>)(nil)
#f(compiled-function (&optional btn item callback) #<bytecode -0xd8ad6eb77d4b63a>)(#<marker (moves after insertion) at 15 in *dap-ui-locals*> (:label "Nothing to display..." :key "foo" :icon :empty) #f(compiled-function (items) #<bytecode -0x4d491a752017148>))
treemacs-update-async-node((lsp-treemacs-generic-root "foo"))
treemacs-expand-extension-node(0)
treemacs--do-expand-variadic-parent(#<marker at 1 in *dap-ui-locals*> #s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1dc015a07f494>) :open-state #f(compiled-function () #<bytecode 0x1dc015a07e954>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2451dd26651068>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2451dc875178a8>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1dc01634677d4>) :variadic? t :async? nil :entry-point? t) 1)
treemacs--variadic-extension-entry-render(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1dc015a07f494>) :open-state #f(compiled-function () #<bytecode 0x1dc015a07e954>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2451dd26651068>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2451dc875178a8>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1dc01634677d4>) :variadic? t :async? nil :entry-point? t) 1)
treemacs--render-extension(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1dc015a07f494>) :open-state #f(compiled-function () #<bytecode 0x1dc015a07e954>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2451dd26651068>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2451dc875178a8>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2451df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1dc01634677d4>) :variadic? t :async? nil :entry-point? t) 1)
lsp-treemacs-render(((:label "Nothing to display..." :key "foo" :icon :empty)) " Locals " 1 "*dap-ui-locals*")
dap-ui-locals()
...
Also saw something about "invalid function lsp-treemacs-wcb-unless-killed", I think this went away when I changed lsp-treemacs-wcb-unless-killed from defmacro to defun.
I'm also getting this issue - I'm on commit #2894e6d. It works if I quote the symbol:
lsp-treemacs/lsp-treemacs-generic.el
Line 133 in 2894e6d
- (treemacs-initialize lsp-treemacs-generic-root
+ (treemacs-initialize 'lsp-treemacs-generic-root
Ah yeah, I see, this seems to be the commit that changed things:
Alexander-Miller/treemacs@20765ac
I'm not sure which repo treemacs is being installed from (I'm running Doom Emacs), but it's pulling the commit before this one.
Here is a backtrace without byte compilation
Debugger entered--Lisp error: (wrong-type-argument listp lsp-treemacs-generic-root)
cdr(lsp-treemacs-generic-root)
(if (cdr goto-path) (progn (setq manual-parts (cons (-last-item goto-path) manual-parts)) (setq goto-path (-butlast goto-path))) (setq goto-path (car goto-path)))
(if (or (null dom-node) (null (treemacs-dom-node->position dom-node))) (if (cdr goto-path) (progn (setq manual-parts (cons (-last-item goto-path) manual-parts)) (setq goto-path (-butlast goto-path))) (setq goto-path (car goto-path))) (setq continue nil))
(while continue (setq dom-node (treemacs-find-in-dom goto-path)) (if (or (null dom-node) (null (treemacs-dom-node->position dom-node))) (if (cdr goto-path) (progn (setq manual-parts (cons (-last-item goto-path) manual-parts)) (setq goto-path (-butlast goto-path))) (setq goto-path (car goto-path))) (setq continue nil)))
(let* ((continue t)) (while continue (setq dom-node (treemacs-find-in-dom goto-path)) (if (or (null dom-node) (null (treemacs-dom-node->position dom-node))) (if (cdr goto-path) (progn (setq manual-parts (cons (-last-item goto-path) manual-parts)) (setq goto-path (-butlast goto-path))) (setq goto-path (car goto-path))) (setq continue nil))))
(let* ((start (point)) (goto-path (if (listp path) (copy-sequence path) (list path))) (manual-parts nil) (dom-node nil)) (let* ((continue t)) (while continue (setq dom-node (treemacs-find-in-dom goto-path)) (if (or (null dom-node) (null (treemacs-dom-node->position dom-node))) (if (cdr goto-path) (progn (setq manual-parts (cons ... manual-parts)) (setq goto-path (-butlast goto-path))) (setq goto-path (car goto-path))) (setq continue nil)))) (let* ((btn (treemacs-dom-node->position dom-node)) (search-result (if manual-parts (catch '--cl-block-search-- (if (memq ... treemacs--closed-node-states) (progn ... ...)) (while manual-parts (let ... ... ... ... ...)) btn) (goto-char btn)))) (if (eq 'follow-failed search-result) (prog1 nil (goto-char start)) (treemacs-dom-node->set-position! (treemacs-find-in-dom path) search-result) search-result)))
treemacs--find-custom-node((lsp-treemacs-generic-root "my_project"))
(cond ((stringp path) (if (and (eq t treemacs--in-this-buffer) (file-exists-p path)) (progn (treemacs-find-file-node path project)))) ((or (symbolp path) (symbolp (car path)) (stringp (car path))) (treemacs--find-custom-node path)) (t (error "Path type did not match: %S" path)))
(let ((path path)) (cond ((stringp path) (if (and (eq t treemacs--in-this-buffer) (file-exists-p path)) (progn (treemacs-find-file-node path project)))) ((or (symbolp path) (symbolp (car path)) (stringp (car path))) (treemacs--find-custom-node path)) (t (error "Path type did not match: %S" path))))
(save-excursion (let ((path path)) (cond ((stringp path) (if (and (eq t treemacs--in-this-buffer) (file-exists-p path)) (progn (treemacs-find-file-node path project)))) ((or (symbolp path) (symbolp (car path)) (stringp (car path))) (treemacs--find-custom-node path)) (t (error "Path type did not match: %S" path)))))
treemacs-find-node((lsp-treemacs-generic-root "my_project"))
(let* ((button (treemacs-find-node updated-path))) (put-text-property (or (previous-single-property-change (1+ button) 'button) (point-min)) (or (next-single-property-change button 'button) (point-max)) :busy nil))
(let (buffer-read-only) (treemacs-update-node top-path) (let* ((button (treemacs-find-node updated-path))) (put-text-property (or (previous-single-property-change (1+ button) 'button) (point-min)) (or (next-single-property-change button 'button) (point-max)) :busy nil)))
(save-current-buffer (set-buffer it) (let (buffer-read-only) (treemacs-update-node top-path) (let* ((button (treemacs-find-node updated-path))) (put-text-property (or (previous-single-property-change (1+ button) 'button) (point-min)) (or (next-single-property-change button 'button) (point-max)) :busy nil))))
(progn (save-current-buffer (set-buffer it) (let (buffer-read-only) (treemacs-update-node top-path) (let* ((button (treemacs-find-node updated-path))) (put-text-property (or (previous-single-property-change (1+ button) 'button) (point-min)) (or (next-single-property-change button 'button) (point-max)) :busy nil)))))
(if it (progn (save-current-buffer (set-buffer it) (let (buffer-read-only) (treemacs-update-node top-path) (let* ((button (treemacs-find-node updated-path))) (put-text-property (or (previous-single-property-change ... ...) (point-min)) (or (next-single-property-change button ...) (point-max)) :busy nil))))))
(let ((it (treemacs-get-local-buffer))) (if it (progn (save-current-buffer (set-buffer it) (let (buffer-read-only) (treemacs-update-node top-path) (let* ((button ...)) (put-text-property (or ... ...) (or ... ...) :busy nil)))))))
(progn (let ((it (treemacs-get-local-buffer))) (if it (progn (save-current-buffer (set-buffer it) (let (buffer-read-only) (treemacs-update-node top-path) (let* (...) (put-text-property ... ... :busy nil))))))))
(if (= 0 count) (progn (let ((it (treemacs-get-local-buffer))) (if it (progn (save-current-buffer (set-buffer it) (let (buffer-read-only) (treemacs-update-node top-path) (let* ... ...))))))))
(let* ((count (let* ((v treemacs--async-update-count) (v top-path)) (puthash v (- (gethash v v nil) 1) v)))) (if (= 0 count) (progn (let ((it (treemacs-get-local-buffer))) (if it (progn (save-current-buffer (set-buffer it) (let ... ... ...))))))))
treemacs--async-update-part-complete((lsp-treemacs-generic-root "my_project") ...
(closure ((children-fn closure (t) (&optional btn item callback) (ignore btn item callback) ...
funcall((closure ((children-fn closure (t) (&optional btn item callback) (ignore btn item callback)...
(save-current-buffer (set-buffer buffer) (funcall callback (lsp-treemacs-filter-if-needed result)))
(with-current-buffer buffer (funcall callback (lsp-treemacs-filter-if-needed result)))
(progn (with-current-buffer buffer (funcall callback (lsp-treemacs-filter-if-needed result))))
(if (buffer-live-p (get-buffer buffer)) (progn (with-current-buffer buffer (funcall callback (lsp-treemacs-filter-if-needed result)))))
(when (buffer-live-p (get-buffer buffer)) (with-current-buffer buffer (funcall callback (lsp-treemacs-filter-if-needed result))))
(lsp-treemacs-wcb-unless-killed buffer (funcall callback (lsp-treemacs-filter-if-needed result)))
@bastianbeischer is this with lsp-start-plain? Because it still seems to me that you are running some odd version of the packages.
I see the issue for me - Doom has treemacs pinned to a version using the old interface, while it has for lsp-treemacs, it's downloading a newer version. I've opened a PR to fix it.lsp-treemacs
pinned to
@yyoncho Yes this is reproducible with lsp-start-plain. Steps:
- M-x lsp-start-plain
- Open a python file (see below)
- Set a breakpoint
- M-: (require 'dap-python)
- M-x customize-variable dap-python-debugger -> debugpy
- M-x treemacs (<- it does not happen without this step)
- M-x dap-debug -> Python run file (buffer)
- In sessions buffer open the current session, expand as far as possible and try to jump the current point of execution (double click on current line)
I guess step 5 is not strictly needed, but I have debugpy instead of ptvsd here, so...
Any simple python file will do, example:
#!/usr/bin/env python
import sys
print("hello")
print(sys.argv)
@yyoncho Any ideas on this one? Can you reproduce it with the recipe above?
I haven't had the time. But based on the description this is for treemacs repo.
IOW the order of using treemacs API should not break treemacs.
I see the issue for me - Doom has treemacs pinned to a version using the old interface, while
it hasfor lsp-treemacs, it's downloading a newer version. I've opened a PR to fix it.lsp-treemacs
pinned to
@jcaw did doom ever make this alteration? I seem to have the same problem. As a work around did you just remove the pins in modules/ui/treemacs/packages.el?
Found his PR for those looking to do this on their own for now:
doomemacs/doomemacs#6887 thank you for this @jcaw
Debugger entered--Lisp error: (wrong-type-argument listp lsp-treemacs-generic-root)
I tackled the error over at Alexander-Miller/treemacs#990. This issue should be fixed now if your treemacs version is up-to-date.