treemacs icon indicating copy to clipboard operation
treemacs copied to clipboard

Depth based node-expand prefix arg

Open Alexander-Miller opened this issue 6 years ago • 21 comments

FYI @yyoncho

Alexander-Miller avatar May 19 '19 10:05 Alexander-Miller

@yyoncho I have pushed a first version of this feature to the depth-expand branch. Please give it a try.

It works like this:

  • prefix arg is a number N: expand N additional levels
  • prefix arg is not number & not null: expand everything

Alexander-Miller avatar May 02 '20 10:05 Alexander-Miller

Thank you, I will test and let you know.

yyoncho avatar May 04 '20 18:05 yyoncho

Just tested this branch (rebased with master), and it seems that expanding a node is not working anymore, I tried to debug but could not find anything relevant. On master this not seems to happen.

Error:

funcall: Wrong number of arguments: ((t) (node recursive) "Execute expansion of treemacs nodes of type `generic'." (let ((items lsp-treemacs-tree) (depth (1+ (get-text-property node :depth))) (parent-dom-node (let* ((key (get-text-property node :path))) (ht-get treemacs-dom key)))) (prog1 (save-excursion (let* ((p (point))) (let (buffer-read-only) (put-text-property (or (previous-single-property-change (1+ node) 'button) (point-min)) (or (next-single-property-change node 'button) (point-max)) :state 'treemacs-generic-open-state) (goto-char (or (next-single-property-change node 'button) (point-max))) (progn (insert (apply #'concat (let* ... ... ...)))) (progn (let* ((key ...)) (let (...) (if dom-node ... ... ...))) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn (setq recursive ...) (let ... ...))))) (count-lines p (point)))) (if treemacs-move-forward-on-expand (progn (let* ((parent (let (...) (if result ...))) (child (next-button parent))) (if (equal parent (get-text-property child :parent)) (progn (forward-line 1))))))))), 1

ericdallo avatar May 16 '20 01:05 ericdallo

You didn't find anything because it's all happening in macro-generated code - which is a big reason for my plans to rewrite the extension api to use eieio, but that's another story.

I had prepared a long explanation for the problem, because I thought treemacs was being called wrong, but it looks like I just missed a spot. Fix has been (force) pushed, please try again now.

Alexander-Miller avatar May 16 '20 12:05 Alexander-Miller

The macro-generated code is really hard to debug it, thanks I'll give another try :)

ericdallo avatar May 16 '20 15:05 ericdallo

@Alexander-Miller just getting another new error:

Error
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  >(nil 0)
  (if (> recursive 0) (progn (setq recursive (1- recursive)) (let ((list (treemacs-collect-child-nodes node)) (it-index 0)) (while list (let ((it (car list))) (if (memq (get-text-property node :state) treemacs--closed-node-states) (progn (goto-char ...) (funcall ... node recursive)))) (setq it-index (1+ it-index)) (setq list (cdr list))))))
  (progn (let* ((key (get-text-property node :path))) (let ((dom-node (ht-get treemacs-dom key))) (if dom-node (progn (let* ((v dom-node)) (aset v 5 node)) (let ((--dolist-tail-- ...)) (while --dolist-tail-- (let ... ... ...))) (let ((parent-dom-node ...)) (if parent-dom-node (progn ...)))) (setq dom-node (record 'treemacs-dom-node key nil nil nil node nil nil)) (ht-set! treemacs-dom (aref dom-node 1) dom-node)))) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn (setq recursive (1- recursive)) (let ((list (treemacs-collect-child-nodes node)) (it-index 0)) (while list (let ((it ...)) (if (memq ... treemacs--closed-node-states) (progn ... ...))) (setq it-index (1+ it-index)) (setq list (cdr list)))))))
  (let (buffer-read-only) (put-text-property (or (previous-single-property-change (1+ node) 'button) (point-min)) (or (next-single-property-change node 'button) (point-max)) :state 'treemacs-generic-open-state) (goto-char (or (next-single-property-change node 'button) (point-max))) (progn (insert (apply #'concat (let* ((depth depth) (prefix (concat "\n" ...)) (item (cl-first items)) (strings)) (if item (progn (let ... ...))) (nreverse strings))))) (progn (let* ((key (get-text-property node :path))) (let ((dom-node (ht-get treemacs-dom key))) (if dom-node (progn (let* (...) (aset v 5 node)) (let (...) (while --dolist-tail-- ...)) (let (...) (if parent-dom-node ...))) (setq dom-node (record 'treemacs-dom-node key nil nil nil node nil nil)) (ht-set! treemacs-dom (aref dom-node 1) dom-node)))) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn (setq recursive (1- recursive)) (let ((list (treemacs-collect-child-nodes node)) (it-index 0)) (while list (let (...) (if ... ...)) (setq it-index (1+ it-index)) (setq list (cdr list))))))))
  (let* ((p (point))) (let (buffer-read-only) (put-text-property (or (previous-single-property-change (1+ node) 'button) (point-min)) (or (next-single-property-change node 'button) (point-max)) :state 'treemacs-generic-open-state) (goto-char (or (next-single-property-change node 'button) (point-max))) (progn (insert (apply #'concat (let* ((depth depth) (prefix ...) (item ...) (strings)) (if item (progn ...)) (nreverse strings))))) (progn (let* ((key (get-text-property node :path))) (let ((dom-node (ht-get treemacs-dom key))) (if dom-node (progn (let* ... ...) (let ... ...) (let ... ...)) (setq dom-node (record ... key nil nil nil node nil nil)) (ht-set! treemacs-dom (aref dom-node 1) dom-node)))) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn (setq recursive (1- recursive)) (let ((list ...) (it-index 0)) (while list (let ... ...) (setq it-index ...) (setq list ...))))))) (count-lines p (point)))
  (save-excursion (let* ((p (point))) (let (buffer-read-only) (put-text-property (or (previous-single-property-change (1+ node) 'button) (point-min)) (or (next-single-property-change node 'button) (point-max)) :state 'treemacs-generic-open-state) (goto-char (or (next-single-property-change node 'button) (point-max))) (progn (insert (apply #'concat (let* (... ... ... ...) (if item ...) (nreverse strings))))) (progn (let* ((key (get-text-property node :path))) (let ((dom-node ...)) (if dom-node (progn ... ... ...) (setq dom-node ...) (ht-set! treemacs-dom ... dom-node)))) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn (setq recursive (1- recursive)) (let (... ...) (while list ... ... ...)))))) (count-lines p (point))))
  (prog1 (save-excursion (let* ((p (point))) (let (buffer-read-only) (put-text-property (or (previous-single-property-change (1+ node) 'button) (point-min)) (or (next-single-property-change node 'button) (point-max)) :state 'treemacs-generic-open-state) (goto-char (or (next-single-property-change node 'button) (point-max))) (progn (insert (apply #'concat (let* ... ... ...)))) (progn (let* ((key ...)) (let (...) (if dom-node ... ... ...))) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn (setq recursive ...) (let ... ...))))) (count-lines p (point)))) (if treemacs-move-forward-on-expand (progn (let* ((parent (let (...) (if result ...))) (child (next-button parent))) (if (equal parent (get-text-property child :parent)) (progn (forward-line 1)))))))
  (let ((items lsp-treemacs-tree) (depth (1+ (get-text-property node :depth))) (parent-dom-node (let* ((key (get-text-property node :path))) (ht-get treemacs-dom key)))) (prog1 (save-excursion (let* ((p (point))) (let (buffer-read-only) (put-text-property (or (previous-single-property-change ... ...) (point-min)) (or (next-single-property-change node ...) (point-max)) :state 'treemacs-generic-open-state) (goto-char (or (next-single-property-change node ...) (point-max))) (progn (insert (apply ... ...))) (progn (let* (...) (let ... ...)) (treemacs--reentry (get-text-property node :path)) nil (if (> recursive 0) (progn ... ...)))) (count-lines p (point)))) (if treemacs-move-forward-on-expand (progn (let* ((parent (let ... ...)) (child (next-button parent))) (if (equal parent (get-text-property child :parent)) (progn (forward-line 1))))))))
  treemacs--do-expand-generic(# nil)
  funcall(treemacs--do-expand-generic # nil)
  (let ((marker (copy-marker (point) t))) (funcall 'treemacs--do-expand-generic button-start nil) (goto-char marker))
  (let* ((pr (record 'treemacs-project "" 'LSP-Generic 'extension)) (button-start (point-marker)) (dom-node (record 'treemacs-dom-node 'LSP-Generic nil nil nil button-start nil nil))) (let* ((position (point-marker))) (ht-set! treemacs--project-positions (if (and (memq (type-of 'LSP-Generic) cl-struct-treemacs-project-tags) t) (aref 'LSP-Generic 2) 'LSP-Generic) position)) (ht-set! treemacs-dom (aref dom-node 1) dom-node) (insert (propertize "Hidden Node\n" 'button '(t) 'category 'default-button 'invisible t 'skip t :custom t :key 'LSP-Generic :path (list :custom 'LSP-Generic) :depth -1 :project pr :state treemacs-generic-closed-state)) (let ((marker (copy-marker (point) t))) (funcall 'treemacs--do-expand-generic button-start nil) (goto-char marker)))
  (save-excursion (let* ((pr (record 'treemacs-project "" 'LSP-Generic 'extension)) (button-start (point-marker)) (dom-node (record 'treemacs-dom-node 'LSP-Generic nil nil nil button-start nil nil))) (let* ((position (point-marker))) (ht-set! treemacs--project-positions (if (and (memq (type-of ...) cl-struct-treemacs-project-tags) t) (aref 'LSP-Generic 2) 'LSP-Generic) position)) (ht-set! treemacs-dom (aref dom-node 1) dom-node) (insert (propertize "Hidden Node\n" 'button '(t) 'category 'default-button 'invisible t 'skip t :custom t :key 'LSP-Generic :path (list :custom 'LSP-Generic) :depth -1 :project pr :state treemacs-generic-closed-state)) (let ((marker (copy-marker (point) t))) (funcall 'treemacs--do-expand-generic button-start nil) (goto-char marker))))
  (let (buffer-read-only) (save-excursion (let* ((pr (record 'treemacs-project "" 'LSP-Generic 'extension)) (button-start (point-marker)) (dom-node (record 'treemacs-dom-node 'LSP-Generic nil nil nil button-start nil nil))) (let* ((position (point-marker))) (ht-set! treemacs--project-positions (if (and (memq ... cl-struct-treemacs-project-tags) t) (aref 'LSP-Generic 2) 'LSP-Generic) position)) (ht-set! treemacs-dom (aref dom-node 1) dom-node) (insert (propertize "Hidden Node\n" 'button '(t) 'category 'default-button 'invisible t 'skip t :custom t :key 'LSP-Generic :path (list :custom 'LSP-Generic) :depth -1 :project pr :state treemacs-generic-closed-state)) (let ((marker (copy-marker (point) t))) (funcall 'treemacs--do-expand-generic button-start nil) (goto-char marker)))))
  treemacs-GENERIC-extension()
  (if (derived-mode-p 'treemacs-mode) nil (treemacs-initialize) (lsp-treemacs-generic-mode t) (treemacs-GENERIC-extension))
  lsp-treemacs-initialize()
  (save-current-buffer (set-buffer search-buffer) (lsp-treemacs-initialize) (set (make-local-variable 'treemacs-default-visit-action) 'treemacs-RET-action) (set (make-local-variable 'lsp-treemacs--right-click-actions) right-click-actions) (set (make-local-variable 'lsp-treemacs--generic-cache) (or lsp-treemacs--generic-cache (let ((ht-temp (ht-create))) ht-temp))) (set (make-local-variable 'lsp-treemacs-tree) tree) (set (make-local-variable 'face-remapping-alist) '((button . default))) (lsp-treemacs--set-mode-line-format search-buffer title) (lsp-treemacs-generic-refresh) (if expand\? (progn (lsp-treemacs--expand 'LSP-Generic))) (current-buffer))
  (let ((search-buffer (get-buffer-create (or buffer-name "*LSP Lookup*")))) (save-current-buffer (set-buffer search-buffer) (lsp-treemacs-initialize) (set (make-local-variable 'treemacs-default-visit-action) 'treemacs-RET-action) (set (make-local-variable 'lsp-treemacs--right-click-actions) right-click-actions) (set (make-local-variable 'lsp-treemacs--generic-cache) (or lsp-treemacs--generic-cache (let ((ht-temp (ht-create))) ht-temp))) (set (make-local-variable 'lsp-treemacs-tree) tree) (set (make-local-variable 'face-remapping-alist) '((button . default))) (lsp-treemacs--set-mode-line-format search-buffer title) (lsp-treemacs-generic-refresh) (if expand\? (progn (lsp-treemacs--expand 'LSP-Generic))) (current-buffer)))
  lsp-treemacs-render(((:label #("Dart" 0 4 (face dap-ui-sessions-terminated-face)) :key "Dart" :session #s(dap--debug-session :name "Dart" :last-id 12 :proc # :response-handlers # :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 # :thread-id nil :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-ext...") :program "/home/greg/dev/dart_sample/bin/main.da...") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #) :ret-action dap-ui-session-select :icon session-terminated :actions (["Select" dap-ui-session-select] ["Delete Session" dap-ui-delete-session] "--" ["Delete All Sessions" dap-delete-all-sessions]) :children-async nil) (:label #("Dart" 0 7 (face dap-ui-sessions-active-session-face)) :key "Dart" :session #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-ext...") :program "/home/greg/dev/dart_sample/bin/main.da...") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #) :ret-action dap-ui-session-select :icon session-started :actions (["Select" dap-ui-session-select] ["Disconnect" dap-ui-disconnect] ["Delete Session" dap-ui-delete-session] "--" ["Delete All Sessions" dap-delete-all-sessions]) :children-async (closure ((thread-states . #) (name . "Dart") (session . ...) (input0 . ...) dap-ui-breakpoints-ui-list-mode-abbrev-table dap-ui-breakpoints-ui-list-mode-syntax-table t) (_node callback) (dap--send-message (dap--make-request "threads") #'... session)))) " Debug Sessions " nil "*dap-ui-sessions*" (["Delete All Sessions" dap-delete-all-sessions]))
  (dap-ui--show-buffer (lsp-treemacs-render (dap-ui--sessions-tree) " Debug Sessions " nil dap-ui--sessions-buffer '(["Delete All Sessions" dap-delete-all-sessions])))
  dap-ui-sessions()
  funcall(dap-ui-sessions)
  (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 ((_session . #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #)) dap-ui-breakpoints-ui-list-mode-abbrev-table dap-ui-breakpoints-ui-list-mode-syntax-table 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)
  mapc((closure ((_session . #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #)) dap-ui-breakpoints-ui-list-mode-abbrev-table dap-ui-breakpoints-ui-list-mode-syntax-table 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 ((_session . #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #)) dap-ui-breakpoints-ui-list-mode-abbrev-table dap-ui-breakpoints-ui-list-mode-syntax-table 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))
  dap-ui--show-many-windows(#s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #))
  run-hook-with-args(dap-ui--show-many-windows #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #))
  (progn (progn (or (and (memq (type-of debug-session) cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list 'dap--debug-session debug-session))) (let* ((v debug-session)) (aset v 7 thread-id))) (run-hook-with-args 'dap-stopped-hook debug-session))
  (if (or force (not (progn (or (and (memq (type-of debug-session) cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list 'dap--debug-session debug-session))) (aref debug-session 7)))) (progn (progn (or (and (memq (type-of debug-session) cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list 'dap--debug-session debug-session))) (let* ((v debug-session)) (aset v 7 thread-id))) (run-hook-with-args 'dap-stopped-hook debug-session)))
  dap--select-thread-id(#s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #) 0)
  (let* ((thread-id (gethash "threadId" body)) (type (gethash "type" body)) (reason (gethash "reason" body))) (puthash thread-id (or type reason) (progn (or (and (memq (type-of debug-session) cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list 'dap--debug-session debug-session))) (aref debug-session 10))) (dap--select-thread-id debug-session thread-id) (if (string= "exception" reason) (progn (dap--send-message (dap--make-request "exceptionInfo" (list :threadId thread-id)) #'(lambda (input0) (let* (... ... ...) (lsp--error "Exception has occurred: %s\n%s" exception-id description))) debug-session))) (run-hooks 'dap-session-changed-hook))
  (cond ((equal event-type '"output") (let ((formatted-output (dap--output-buffer-format body))) (if formatted-output (let ((formatted-output (let* ... ...))) (if formatted-output (progn (if ... ...))))))) ((equal event-type '"breakpoint") (let ((breakpoint (if body (progn (gethash "breakpoint" body))))) (if breakpoint (let ((id (gethash "id" breakpoint))) (if id (let (...) (if file-name ...))))))) ((equal event-type '"thread") (let* ((id (gethash "threadId" body)) (reason (gethash "reason" body))) (puthash id reason (progn (or (and (memq ... cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list ... debug-session))) (aref debug-session 10))) (run-hooks 'dap-session-changed-hook) (dap--send-message (dap--make-request "threads") #'(lambda (input0) (let* (...) (progn ... ...) (run-hooks ...))) debug-session))) ((equal event-type '"exited") (dap--mark-session-as-terminated debug-session)) ((equal event-type '"continued") (let* ((thread-id (gethash "threadId" body))) (remhash thread-id (progn (or (and (memq ... cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list ... debug-session))) (aref debug-session 10))) (if (and (equal thread-id (progn (or ... ...) (aref debug-session 7))) (equal debug-session (dap--cur-session))) (dap--resume-application debug-session) (run-hooks 'dap-session-changed-hook)))) ((equal event-type '"stopped") (let* ((thread-id (gethash "threadId" body)) (type (gethash "type" body)) (reason (gethash "reason" body))) (puthash thread-id (or type reason) (progn (or (and (memq ... cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list ... debug-session))) (aref debug-session 10))) (dap--select-thread-id debug-session thread-id) (if (string= "exception" reason) (progn (dap--send-message (dap--make-request "exceptionInfo" (list :threadId thread-id)) #'(lambda ... ...) debug-session))) (run-hooks 'dap-session-changed-hook))) ((equal event-type '"terminated") (dap--mark-session-as-terminated debug-session)) ((equal event-type '"usernotification") (let* ((notification-type (gethash "notificationType" body)) (message (gethash "message" body))) (warn (format "[%s] %s" notification-type message)))) ((equal event-type '"initialized") (dap--configure-breakpoints debug-session (dap--get-breakpoints) (apply-partially #'dap--send-configuration-done debug-session))) ((equal event-type '"loadedSource") (let* ((source (gethash "source" (gethash "body" event)))) (progn (or (and (memq (type-of debug-session) cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list 'dap--debug-session debug-session))) (let* ((v debug-session)) (aset v 20 (let* (...) (if ... vlist ...))))) (run-hook-with-args 'dap-loaded-sources-changed-hook debug-session))) (t (dap-handle-event (intern event-type) debug-session body)))
  (let* ((body (gethash "body" event)) (event-type (gethash "event" event))) (cond ((equal event-type '"output") (let ((formatted-output (dap--output-buffer-format body))) (if formatted-output (let ((formatted-output ...)) (if formatted-output (progn ...)))))) ((equal event-type '"breakpoint") (let ((breakpoint (if body (progn ...)))) (if breakpoint (let ((id ...)) (if id (let ... ...)))))) ((equal event-type '"thread") (let* ((id (gethash "threadId" body)) (reason (gethash "reason" body))) (puthash id reason (progn (or (and ... t) (signal ... ...)) (aref debug-session 10))) (run-hooks 'dap-session-changed-hook) (dap--send-message (dap--make-request "threads") #'(lambda (input0) (let* ... ... ...)) debug-session))) ((equal event-type '"exited") (dap--mark-session-as-terminated debug-session)) ((equal event-type '"continued") (let* ((thread-id (gethash "threadId" body))) (remhash thread-id (progn (or (and ... t) (signal ... ...)) (aref debug-session 10))) (if (and (equal thread-id (progn ... ...)) (equal debug-session (dap--cur-session))) (dap--resume-application debug-session) (run-hooks 'dap-session-changed-hook)))) ((equal event-type '"stopped") (let* ((thread-id (gethash "threadId" body)) (type (gethash "type" body)) (reason (gethash "reason" body))) (puthash thread-id (or type reason) (progn (or (and ... t) (signal ... ...)) (aref debug-session 10))) (dap--select-thread-id debug-session thread-id) (if (string= "exception" reason) (progn (dap--send-message (dap--make-request "exceptionInfo" ...) #'... debug-session))) (run-hooks 'dap-session-changed-hook))) ((equal event-type '"terminated") (dap--mark-session-as-terminated debug-session)) ((equal event-type '"usernotification") (let* ((notification-type (gethash "notificationType" body)) (message (gethash "message" body))) (warn (format "[%s] %s" notification-type message)))) ((equal event-type '"initialized") (dap--configure-breakpoints debug-session (dap--get-breakpoints) (apply-partially #'dap--send-configuration-done debug-session))) ((equal event-type '"loadedSource") (let* ((source (gethash "source" (gethash "body" event)))) (progn (or (and (memq ... cl-struct-dap--debug-session-tags) t) (signal 'wrong-type-argument (list ... debug-session))) (let* ((v debug-session)) (aset v 20 (let* ... ...)))) (run-hook-with-args 'dap-loaded-sources-changed-hook debug-session))) (t (dap-handle-event (intern event-type) debug-session body))))
  dap--on-event(#s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #) #)
  (cond ((equal val '"event") (dap--on-event debug-session parsed-msg)) ((equal val '"response") (let* ((callback (and t (gethash key handlers nil)))) (if callback (progn (funcall callback parsed-msg) (remhash key handlers) (run-hook-with-args 'dap-executed-hook debug-session (gethash "command" parsed-msg))) (message "Unable to find handler for %s." (pp parsed-msg))))) ((equal val '"request") (let* ((--dash-source-441-- (gethash "arguments" parsed-msg)) (args (let ((src --dash-source-441--)) (if src (progn ...)))) (cwd (let ((src --dash-source-441--)) (if src (progn ...)))) (title (let ((src --dash-source-441--)) (if src (progn ...)))) (command (gethash "command" parsed-msg)) (seq (gethash "seq" parsed-msg)) (default-directory cwd)) (async-shell-command (s-join " " args)) (dap--send-message (dap--make-response seq) (dap--resp-handler) debug-session))) (t nil))
  (let* ((val (gethash "type" parsed-msg))) (cond ((equal val '"event") (dap--on-event debug-session parsed-msg)) ((equal val '"response") (let* ((callback (and t (gethash key handlers nil)))) (if callback (progn (funcall callback parsed-msg) (remhash key handlers) (run-hook-with-args 'dap-executed-hook debug-session (gethash "command" parsed-msg))) (message "Unable to find handler for %s." (pp parsed-msg))))) ((equal val '"request") (let* ((--dash-source-441-- (gethash "arguments" parsed-msg)) (args (let (...) (if src ...))) (cwd (let (...) (if src ...))) (title (let (...) (if src ...))) (command (gethash "command" parsed-msg)) (seq (gethash "seq" parsed-msg)) (default-directory cwd)) (async-shell-command (s-join " " args)) (dap--send-message (dap--make-response seq) (dap--resp-handler) debug-session))) (t nil)))
  (let* ((parsed-msg (dap--read-json m)) (key (gethash "request_seq" parsed-msg nil))) (if dap-print-io (progn (let ((inhibit-message dap-inhibit-io)) (message "Received:\n%s" (dap--json-encode parsed-msg))))) (let* ((val (gethash "type" parsed-msg))) (cond ((equal val '"event") (dap--on-event debug-session parsed-msg)) ((equal val '"response") (let* ((callback (and t ...))) (if callback (progn (funcall callback parsed-msg) (remhash key handlers) (run-hook-with-args ... debug-session ...)) (message "Unable to find handler for %s." (pp parsed-msg))))) ((equal val '"request") (let* ((--dash-source-441-- (gethash "arguments" parsed-msg)) (args (let ... ...)) (cwd (let ... ...)) (title (let ... ...)) (command (gethash "command" parsed-msg)) (seq (gethash "seq" parsed-msg)) (default-directory cwd)) (async-shell-command (s-join " " args)) (dap--send-message (dap--make-response seq) (dap--resp-handler) debug-session))) (t nil))))
  (closure ((msg . "Content-Length: 87\15\n\15\n{\"seq\":17,\"type\":\"event\",\"ev...") (_ . #>) (handlers . #) (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 "")) (debug-session . #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #)) cl-struct-dap--parser-tags cl-struct-dap--debug-session-tags t) (m) (let* ((parsed-msg (dap--read-json m)) (key (gethash "request_seq" parsed-msg nil))) (if dap-print-io (progn (let ((inhibit-message dap-inhibit-io)) (message "Received:\n%s" (dap--json-encode parsed-msg))))) (let* ((val (gethash "type" parsed-msg))) (cond ((equal val '"event") (dap--on-event debug-session parsed-msg)) ((equal val '"response") (let* (...) (if callback ... ...))) ((equal val '"request") (let* (... ... ... ... ... ... ...) (async-shell-command ...) (dap--send-message ... ... debug-session))) (t nil)))))("{\"seq\":17,\"type\":\"event\",\"event\":\"stopped\",\"body\":...")
  mapc((closure ((msg . "Content-Length: 87\15\n\15\n{\"seq\":17,\"type\":\"event\",\"ev...") (_ . #>) (handlers . #) (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 "")) (debug-session . #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #)) cl-struct-dap--parser-tags cl-struct-dap--debug-session-tags t) (m) (let* ((parsed-msg (dap--read-json m)) (key (gethash "request_seq" parsed-msg nil))) (if dap-print-io (progn (let ((inhibit-message dap-inhibit-io)) (message "Received:\n%s" (dap--json-encode parsed-msg))))) (let* ((val (gethash "type" parsed-msg))) (cond ((equal val '"event") (dap--on-event debug-session parsed-msg)) ((equal val '"response") (let* (...) (if callback ... ...))) ((equal val '"request") (let* (... ... ... ... ... ... ...) (async-shell-command ...) (dap--send-message ... ... debug-session))) (t nil))))) ("{\"seq\":17,\"type\":\"event\",\"event\":\"stopped\",\"body\":..."))
  (closure ((handlers . #) (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 "")) (debug-session . #s(dap--debug-session :name "Dart" :last-id 11 :proc #> :response-handlers # :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 # out*> :thread-id 0 :workspace nil :threads (#) :thread-states # :active-frame-id nil :active-frame nil :cursor-marker nil :state running :breakpoints # :thread-stack-frames # :launch-args (:type "dart" :request "launch" :dartPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :cwd "/home/greg/dev/dart_sample/" :pubPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :pubSnapshotPath "/nix/store/i6mq9yb6d120m6kvakq4z4dcsl2sh5wl-dart-2..." :vmAdditionalArgs "" :debugExternalLibraries nil :debugSdkLibraries nil :flutterPath "/home/greg/flutter/bin/flutter" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :name "Dart" :dap-server-path ("node" "/home/greg/.emacs.d/.local/etc/dap-extension/githu...") :program "/home/greg/dev/dart_sample/bin/main.dart") :initialize-result # :error-message nil :loaded-sources nil :program-proc nil :metadata #)) cl-struct-dap--parser-tags cl-struct-dap--debug-session-tags t) (_ msg) (mapc #'(lambda (m) (let* ((parsed-msg ...) (key ...)) (if dap-print-io (progn ...)) (let* (...) (cond ... ... ... ...)))) (dap--parser-read parser msg)))(#> "Content-Length: 87\15\n\15\n{\"seq\":17,\"type\":\"event\",\"ev...")

I'm just testing the branch with lsp-treemacs master, and it breaks when I call this function

Am I doing something wrong?

ericdallo avatar May 16 '20 15:05 ericdallo

Next version pushed. Changed my approach, so the kind of gaps you're running into should not exist now.

Alexander-Miller avatar May 17 '20 13:05 Alexander-Miller

There is a typo on https://github.com/Alexander-Miller/treemacs/blob/698a403c89ee038debbda70cba4945d73c0ae014/src/elisp/treemacs-extensions.el#L379

The argument should be recursive not recusrive

kira-bruneau avatar May 29 '20 02:05 kira-bruneau

Sorry for the delay - this issue just fell through the cracks (feel free to bump if that happens).

Fix is pushed now.

Alexander-Miller avatar Jun 18 '20 21:06 Alexander-Miller

Willing to try again @MetaDark ?

ericdallo avatar Jun 18 '20 21:06 ericdallo

@ericdallo My changes would depend on https://github.com/emacs-lsp/lsp-treemacs/pull/41, if we are going to use it instead of https://github.com/emacs-lsp/lsp-treemacs/pull/44.

kira-bruneau avatar Jun 24 '20 23:06 kira-bruneau

@MetaDark feel free to just incorporate the changes I have so far if that helps and/or if I'm a bottleneck here.

jkdufair avatar Jun 25 '20 17:06 jkdufair

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 07 '21 17:10 stale[bot]

Stayin alive.

Alexander-Miller avatar Oct 07 '21 20:10 Alexander-Miller

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 06 '21 21:12 stale[bot]

Stayin alive.

Alexander-Miller avatar Dec 25 '21 15:12 Alexander-Miller

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 23 '22 15:02 stale[bot]

Stayin alive.

Alexander-Miller avatar Feb 23 '22 18:02 Alexander-Miller

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 24 '22 18:04 stale[bot]

Stayin alive.

Alexander-Miller avatar Apr 25 '22 10:04 Alexander-Miller

This issue has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Jun 24 '22 12:06 stale[bot]