Alexander-Miller / treemacs

GNU General Public License v3.0
2.09k stars 153 forks source link

`Treemacs` errors occur when using `dap-mode` #1077

Closed Aaronzinhoo closed 9 months ago

Aaronzinhoo commented 9 months ago

When trying to use dap-next , I get an error displayed in the minibuffer area related to treemacs. This error slightly changes based on the command in dap but it seems its all related to treemacs. I print the contents of debug-on-error below.

(args-out-of-range #s(treemacs-extension lsp-treemacs-generic-node #[0 "\300\207" [treemacs-lsp-treemacs-generic-node-closed] 1 ""] #[0 "\300\207" [treemacs-lsp-treemacs-generic-node-open] 1 ""] #[512 "\300\1\301\"\207" [lsp-treemacs--generic-icon nil] 5 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\1\301\"\207" [lsp-treemacs--generic-icon t] 5 "\n\n(fn &optional BTN ITEM)"] #[768 "\300\2\301\"\300\3\302\"\303\2!\203\27\0\2\304\3\6\6!!!\207\211\203&\0p\1\5\305\306\4\6\10#\"\207\2\304\3!!\207" [plist-get :children :children-async functionp lsp-treemacs-filter-if-needed make-closure #[257 "\302\303\300!!\205\22\0r\300q\210\301\304\2!!)\207" [V0 V1 buffer-live-p get-buffer lsp-treemacs-filter-if-needed] 4 "\n\n(fn RESULT)"]] 12 "\n\n(fn &optional BTN ITEM CALLBACK)"] #[512 "\300\1\301\"\207" [plist-get :key] 5 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\1\301\"\207" [plist-get :label] 5 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\207" [nil] 3 "\n\n(fn &optional BTN ITEM)"] #[0 "\300J\207" [treemacs-lsp-treemacs-generic-node-extension-instance] 1 ""] nil t nil) 14)
cl-prin1: (args-out-of-range #s(treemacs-extension lsp-treemacs-generic-root #[0 "\300\207" [treemacs-lsp-treemacs-generic-root-closed] 1 ""] #[0 "\300\207" [treemacs-lsp-treemacs-generic-root-open] 1 ""] #[512 "\300\207" [""] 3 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\207" [""] 3 "\n\n(fn &optional BTN ITEM)"] #[512 "\10\207" [lsp-treemacs-tree] 3 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\207" [lsp-treemacs-generic-root] 3 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\207" [nil] 3 "\n\n(fn &optional BTN ITEM)"] #[512 "\300\207" [nil] 3 "\n\n(fn &optional BTN ITEM)"] #[0 "\300J\207" [treemacs-lsp-treemacs-generic-node-extension-instance] 1 ""] t nil t) 14)

Setup

Config

(use-package lsp-mode)
(use-package lsp-treemacs
  :commands (treemacs lsp-treemacs-errors-list))
(use-package dap-mode ;; treemacs pulled in as transitive dependency
  :requires (lsp-mode lsp-docker)
  :straight (:type git :host github :repo "emacs-lsp/dap-mode" :branch "master")
  :hook ((lsp-mode . dap-auto-configure-mode)
         ;; dap-stopped called after breakpoint hit
         (dap-stopped . (lambda (arg) (call-interactively #'dap-hydra))))
  :custom
  (dap-ui-controls-mode -1)
  :config
  (dap-ui-mode -1))
(use-package treemacs-nerd-icons
  :after (treemacs)
  :config
  (treemacs-load-theme "nerd-icons"))
(use-package lsp-java
  :straight (:type git :host github :repo "emacs-lsp/lsp-java" :branch "master")
  :hook ((java-ts-mode . lsp-deferred)
         (java-ts-mode . lsp-java-boot-lens-mode))
  :config
  (let ((lombok-file (concat user-init-dir-fullpath "deps/lombok-1.18.26.jar")))
    ;; current VSCode defaults
    (setq lsp-java-vmargs (list "-XX:+UseParallelGC" "-XX:GCTimeRatio=4" "-XX:AdaptiveSizePolicyWeight=90" "-Dsun.zip.disableMemoryMapping=true" "-Xmx2G" "-Xms100m" (concat "-javaagent:" lombok-file))))
  (require 'lsp-java-boot))
(use-package dap-java
  :after (lsp-java dap)
  :straight (dap-java :type git :host github :repo "emacs-lsp/lsp-java" :branch "master"))

debug-on-error output

Debugger entered--Lisp error: (args-out-of-range #s(treemacs-extension :name lsp-treemacs-generic-node :closed-state #f(compiled-function () #<bytecode 0x1981c4d171754>) :open-state #f(compiled-function () #<bytecode 0x1981c4d170a94>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2430007c32d860>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2430007c321520>) :children #f(compiled-function (&optional btn item callback) #<bytecode 0x6f70232a0749bc7>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2431f55fd01fe0>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd243df4383668a0>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :child-type #f(compiled-function () #<bytecode 0x1981c43c57e14>) :variadic? nil :async? t :entry-point? nil :on-expand 
  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 0x1981c4d175954>) :open-state #f(compiled-function () #<bytecode 0x1981c4d174494>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd243de98fbb7da8>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd243df345d92d68>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :child-type #f(compiled-function () #<bytecode 0x1981c43c57e14>) :variadic? t :async? nil :entry-point? t :on-expand 
  treemacs--variadic-extension-entry-render(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1981c4d175954>) :open-state #f(compiled-function () #<bytecode 0x1981c4d174494>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd243de98fbb7da8>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd243df345d92d68>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :child-type #f(compiled-function () #<bytecode 0x1981c43c57e14>) :variadic? t :async? nil :entry-point? t :on-expand 
  treemacs--render-extension(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1981c4d175954>) :open-state #f(compiled-function () #<bytecode 0x1981c4d174494>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd243de98fbb7da8>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd243df345d92d68>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd243ddf39e58928>) :child-type #f(compiled-function () #<bytecode 0x1981c43c57e14>) :variadic? t :async? nil :entry-point? t :on-expand 
  lsp-treemacs-render(((:label "Nothing to display..." :key "foo" :icon :empty)) " Locals " 1 "*dap-ui-locals*")
  (save-current-buffer (set-buffer (get-buffer-create dap-ui--locals-buffer)) (add-hook 'dap-terminated-hook #'dap-ui-locals--refresh-schedule) (add-hook 'dap-session-changed-hook #'dap-ui-locals--refresh-schedule) (add-hook 'dap-continue-hook #'dap-ui-locals--refresh-schedule) (add-hook 'dap-stack-frame-changed-hook #'dap-ui-locals--refresh-schedule) (add-hook 'kill-buffer-hook #'dap-ui-locals--cleanup-hooks nil t) (lsp-treemacs-render (dap-ui-locals-get-data) " Locals " dap-ui-locals-expand-depth dap-ui--locals-buffer) (dap-ui--show-buffer (current-buffer)))
  dap-ui-locals()
  funcall(dap-ui-locals)
  (if start-stop (funcall (car start-stop)) nil)
  (let* ((start-stop (and t (alist-get feature-start-stop dap-features->windows)))) (if start-stop (funcall (car start-stop)) nil))
  (closure (t) (feature-start-stop) (let* ((start-stop (and t (alist-get feature-start-stop dap-features->windows)))) (if start-stop (funcall (car start-stop)) nil)))(locals)
  mapc((closure (t) (feature-start-stop) (let* ((start-stop (and t (alist-get feature-start-stop dap-features->windows)))) (if start-stop (funcall (car start-stop)) nil))) (sessions locals breakpoints expressions controls tooltip))
  seq-do((closure (t) (feature-start-stop) (let* ((start-stop (and t (alist-get feature-start-stop dap-features->windows)))) (if start-stop (funcall (car start-stop)) nil))) (sessions locals breakpoints expressions controls tooltip))
  (if dap-ui--many-windows-displayed nil (seq-do #'(lambda (feature-start-stop) (let* ((start-stop (and t ...))) (if start-stop (funcall (car start-stop)) nil))) dap-auto-configure-features) (setq dap-ui--many-windows-displayed t))
  dap-ui--show-many-windows(#s(dap--debug-session :name "Java Attach" :last-id 6 :proc #<process Java Attach> :response-handlers #<hash-table eql 0/65 0x5691e9d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *Java Attach out*> :thread-id 3 :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x569b96c5> :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints #<hash-table equal 3/65 0x5d7c2ea9> :thread-stack-frames #<hash-table eql 0/65 0x5d7c2ec9> :launch-args (:name "Java Attach" :type "java" :request "attach" :hostName "localhost" :port 9000 :vmArgs nil :host "localhost" :debugServer 59479 :__sessionId "1702267128.678418") :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae2b00ba37cf7bf>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae2b00ba305b7bf>) :current-capabilities #<hash-table equal 16/65 0x5e3d20b1> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x5e3d20d1> :output-displayed nil))
  dap--select-thread-id(#s(dap--debug-session :name "Java Attach" :last-id 6 :proc #<process Java Attach> :response-handlers #<hash-table eql 0/65 0x5691e9d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *Java Attach out*> :thread-id 3 :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x569b96c5> :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints #<hash-table equal 3/65 0x5d7c2ea9> :thread-stack-frames #<hash-table eql 0/65 0x5d7c2ec9> :launch-args (:name "Java Attach" :type "java" :request "attach" :hostName "localhost" :port 9000 :vmArgs nil :host "localhost" :debugServer 59479 :__sessionId "1702267128.678418") :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae2b00ba37cf7bf>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae2b00ba305b7bf>) :current-capabilities #<hash-table equal 16/65 0x5e3d20b1> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x5e3d20d1> :output-displayed nil) 3)
  dap--on-event(#s(dap--debug-session :name "Java Attach" :last-id 6 :proc #<process Java Attach> :response-handlers #<hash-table eql 0/65 0x5691e9d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *Java Attach out*> :thread-id 3 :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x569b96c5> :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints #<hash-table equal 3/65 0x5d7c2ea9> :thread-stack-frames #<hash-table eql 0/65 0x5d7c2ec9> :launch-args (:name "Java Attach" :type "java" :request "attach" :hostName "localhost" :port 9000 :vmArgs nil :host "localhost" :debugServer 59479 :__sessionId "1702267128.678418") :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae2b00ba37cf7bf>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae2b00ba305b7bf>) :current-capabilities #<hash-table equal 16/65 0x5e3d20b1> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x5e3d20d1> :output-displayed nil) #<hash-table equal 4/65 0x5325fca7>)
  #f(compiled-function (m) #<bytecode 0x13dd9fc605c7576b>)("{\"event\":\"stopped\",\"body\":{\"threadId\":3,\"reason\":\"...")
  mapc(#f(compiled-function (m) #<bytecode 0x13dd9fc605c7576b>) ("{\"event\":\"stopped\",\"body\":{\"threadId\":3,\"reason\":\"..."))
  #f(compiled-function (_ msg) #<bytecode 0xb8e27f43abe26e3>)(#<process Java Attach> "Content-Length: 129\15\n\15\n{\"event\":\"stopped\",\"body\":{...")
Alexander-Miller commented 9 months ago

Problem's somewhere deep in the extensions code. Only advice I can give now is to make sure that all treemacs, lsp and dap are up-to-date and properly recompiled.

If that doesn't help you should move this issue to the dap repo and cc me there, it'll much easier to tell what is going on with input from the dap devs.

Aaronzinhoo commented 9 months ago

@Alexander-Miller Will move the discussion there! Thanks for the response

Alexander-Miller commented 9 months ago

I'll close this issue to keep things clean. We can re-open again if the error turns out to be on my end.