Skip to content

Commit 10c34fc

Browse files
authored
Avoid creating new timer for each invocation of lsp-treemacs-symbols (#90) (#91)
Co-authored-by: Shitikanth Kashyap <shitikanth1@gmail.com>
1 parent b412f16 commit 10c34fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lsp-treemacs.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ will be rendered an empty line between them."
375375
(setq-local treemacs-default-visit-action 'treemacs-RET-action)
376376
(setq-local treemacs-space-between-root-nodes
377377
lsp-treemacs-symbols-space-between-root-nodes)
378-
(setq lsp-treemacs--symbols-timer (run-at-time 0 1.0 #'lsp-treemacs--update))
378+
(unless lsp-treemacs--symbols-timer
379+
(setq lsp-treemacs--symbols-timer (run-with-idle-timer 1 t #'lsp-treemacs--update)))
379380
(add-hook 'kill-buffer-hook 'lsp-treemacs--kill-symbols-buffer nil t)))
380381
(with-current-buffer original-buffer (lsp-treemacs--update))))
381382

0 commit comments

Comments
 (0)