Skip to content

Commit 50c4d78

Browse files
authored
Revert "Revert "Added depth argument to lsp-treemacs--expand"" (#44)
1 parent 8edb119 commit 50c4d78

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lsp-treemacs.el

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,10 @@
554554
(add-to-list 'winum-ignored-buffers "*LSP Error List*")
555555
(add-to-list 'winum-ignored-buffers lsp-treemacs-deps-buffer-name)))
556556

557-
(defun lsp-treemacs--expand (root-key)
557+
(defun lsp-treemacs--expand (root-key depth)
558558
(-when-let (root (treemacs-dom-node->position (treemacs-find-in-dom root-key)))
559559
(treemacs-save-position
560-
(lsp-treemacs--expand-recursively root))))
560+
(lsp-treemacs--expand-recursively root depth))))
561561

562562
(defun lsp-treemacs--kill-symbols-buffer ()
563563
(and lsp-treemacs--symbols-timer (cancel-timer lsp-treemacs--symbols-timer)))
@@ -579,16 +579,16 @@
579579
(add-hook 'kill-buffer-hook 'lsp-treemacs--kill-symbols-buffer nil t)))
580580
(with-current-buffer original-buffer (lsp-treemacs--update))))
581581

582-
(defun lsp-treemacs--expand-recursively (root)
583-
(save-excursion
584-
(-map
585-
(lambda (btn)
586-
(unless (treemacs-is-node-expanded? btn)
587-
(goto-char (marker-position btn))
588-
(funcall (alist-get (treemacs-button-get btn :state) treemacs-TAB-actions-config)))
589-
(lsp-treemacs--expand-recursively btn))
590-
(treemacs-collect-child-nodes root))))
591-
582+
(defun lsp-treemacs--expand-recursively (root depth)
583+
(when (if (booleanp depth) depth (not (zerop depth)))
584+
(save-excursion
585+
(-map
586+
(lambda (btn)
587+
(unless (treemacs-is-node-expanded? btn)
588+
(goto-char (marker-position btn))
589+
(funcall (alist-get (treemacs-button-get btn :state) treemacs-TAB-actions-config)))
590+
(lsp-treemacs--expand-recursively btn (if (booleanp depth) depth (1- depth))))
591+
(treemacs-collect-child-nodes root)))))
592592

593593
(defmacro lsp-treemacs-deps-with-jdtls (&rest body)
594594
"Helper macro for invoking BODY against WORKSPACE context."
@@ -1091,7 +1091,7 @@
10911091
,@body)
10921092
(treemacs-pulse-on-failure "No node at point"))))
10931093

1094-
(defun lsp-treemacs-render (tree title expand? &optional buffer-name right-click-actions)
1094+
(defun lsp-treemacs-render (tree title expand-depth &optional buffer-name right-click-actions)
10951095
(let ((search-buffer (get-buffer-create (or buffer-name "*LSP Lookup*"))))
10961096
(with-current-buffer search-buffer
10971097
(lsp-treemacs-initialize)
@@ -1102,7 +1102,7 @@
11021102
(setq-local face-remapping-alist '((button . default)))
11031103
(lsp-treemacs--set-mode-line-format search-buffer title)
11041104
(lsp-treemacs-generic-refresh)
1105-
(when expand? (lsp-treemacs--expand 'LSP-Generic))
1105+
(lsp-treemacs--expand 'LSP-Generic expand-depth)
11061106
(current-buffer))))
11071107

11081108
(defalias 'lsp-treemacs--show-references 'lsp-treemacs-render)

0 commit comments

Comments
 (0)