emacs-lsp / lsp-treemacs

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

Provide const handles to lsp-treemacs buffer names #67

Closed gagbo closed 3 years ago

gagbo commented 3 years ago

This allows users to only worry about using a single variable in their configuration (to use in display-buffer-alist for example) without any fear of breaking change if the name of the buffer ever changes.

gagbo commented 3 years ago

I haven't actually tested it yet, so maybe it breaks something

yyoncho commented 3 years ago

Looks good to me! Can you share your display-buffer-alist usage? I feel like we should somehow utilize it instead of adhoc solution we have ATM but I am unable to figure out how to achieve it.

gagbo commented 3 years ago

It’s going to be more complex than it needs to be because I use a Doom macro that wraps around that, but I’ll try to simplify this later

gagbo commented 3 years ago

Sorry for the spam, it actually took less time than I thought : here's a manually filtered prin1 display-buffer-alist (I'll probably start using rx to build the regex from the const name now)

(("^\\*LSP Symbols List\\*$" (+popup-buffer) (actions) (side . left) (size . 0.3) (window-width . 40) (window-height . 0.16) (slot . 2) (vslot) (window-parameters (ttl . 0) (quit) (select . ignore) (modeline) (autosave))) 
 ("^ \\*Treemacs"            (+popup-buffer) (actions) (side . left) (size . 0.3) (window-width . 40) (window-height . 0.16) (slot . 1) (vslot) (window-parameters (ttl . 0) (quit) (select . ignore) (modeline) (autosave))))

You can ignore the +popup-buffer part, it's an action that consumes the (irrelevant here) vslot custom alist entry. The goal of this couple is to always have the buffers stack in the left column with the width I'd like (prooobably close to the default behaviour, but writing it in my config at least means I understand better how it works and how to tweak that)