|
554 | 554 | (add-to-list 'winum-ignored-buffers "*LSP Error List*") |
555 | 555 | (add-to-list 'winum-ignored-buffers lsp-treemacs-deps-buffer-name))) |
556 | 556 |
|
557 | | -(defun lsp-treemacs--expand (root-key) |
| 557 | +(defun lsp-treemacs--expand (root-key depth) |
558 | 558 | (-when-let (root (treemacs-dom-node->position (treemacs-find-in-dom root-key))) |
559 | 559 | (treemacs-save-position |
560 | | - (lsp-treemacs--expand-recursively root)))) |
| 560 | + (lsp-treemacs--expand-recursively root depth)))) |
561 | 561 |
|
562 | 562 | (defun lsp-treemacs--kill-symbols-buffer () |
563 | 563 | (and lsp-treemacs--symbols-timer (cancel-timer lsp-treemacs--symbols-timer))) |
|
579 | 579 | (add-hook 'kill-buffer-hook 'lsp-treemacs--kill-symbols-buffer nil t))) |
580 | 580 | (with-current-buffer original-buffer (lsp-treemacs--update)))) |
581 | 581 |
|
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))))) |
592 | 592 |
|
593 | 593 | (defmacro lsp-treemacs-deps-with-jdtls (&rest body) |
594 | 594 | "Helper macro for invoking BODY against WORKSPACE context." |
|
1091 | 1091 | ,@body) |
1092 | 1092 | (treemacs-pulse-on-failure "No node at point")))) |
1093 | 1093 |
|
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) |
1095 | 1095 | (let ((search-buffer (get-buffer-create (or buffer-name "*LSP Lookup*")))) |
1096 | 1096 | (with-current-buffer search-buffer |
1097 | 1097 | (lsp-treemacs-initialize) |
|
1102 | 1102 | (setq-local face-remapping-alist '((button . default))) |
1103 | 1103 | (lsp-treemacs--set-mode-line-format search-buffer title) |
1104 | 1104 | (lsp-treemacs-generic-refresh) |
1105 | | - (when expand? (lsp-treemacs--expand 'LSP-Generic)) |
| 1105 | + (lsp-treemacs--expand 'LSP-Generic expand-depth) |
1106 | 1106 | (current-buffer)))) |
1107 | 1107 |
|
1108 | 1108 | (defalias 'lsp-treemacs--show-references 'lsp-treemacs-render) |
|
0 commit comments