emacs-lsp / lsp-treemacs

lsp-mode :heart: treemacs
GNU General Public License v3.0
393 stars 46 forks source link

Does `lsp-treemacs-errors-list` modify `treemacs-select-window`? #171

Open AndreasMatthias opened 5 months ago

AndreasMatthias commented 5 months ago

Using treemacs-select-window I notice a different behavior before and after lsp-treemacs-errors-list.

Save the following file as test.el.

(package-initialize)
(treemacs)
(treemacs-select-window)
(find-file "x1.el")
(split-window-below)
(find-file "x2.el")

(defun jump ()
  (dolist (i '(1 2 3 4 5 6 7 8 9 10))
    (treemacs-select-window)
    (message "%s" (buffer-name))))

(message "=== Before lsp-treemacs-errors-list ===")
(jump)
(lsp-treemacs-errors-list)
(treemacs-quit)
(message "=== After lsp-treemacs-errors-list ===")
(jump)

Run emacs -Q -l test.el. This is the message buffer:

=== Before lsp-treemacs-errors-list ===
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
=== After lsp-treemacs-errors-list ===
x1.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
x1.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
x1.el
 *Treemacs-Scoped-Buffer-#<frame *scratch* - GNU Emacs at home 0x5614b6bad810>*
x2.el
x1.el

You see that treemacs-select-window switches between Treemacs window and x2.el window at the beginning. But this changes after running lsp-treemacs-errors-list. Now treemacs-select-window switches between all windows, i.e. Treemacs, x1.el, x2.el.