emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

lsp-ui-imenu - minor improvements in bindings and display #683

Open sebasmonia opened 2 years ago

sebasmonia commented 2 years ago

lsp-ui-imenu is super nice.

Some of its bindings are a bit off compared to, for example, occur mode or xref (which also have differences between each other...). Or at the very least they surprised me enough that I checked out its keymap:

This is what I have now for lsp-ui-imenu:


(use-package lsp-ui
  :bind
  (:map lsp-ui-imenu-mode-map
        ;; Use bindings that are closer to occur-mode...
        ("n" . next-line)
        ("p" . previous-line)
        ("o" . lsp-ui-imenu--view)
        ("g" . lsp-ui-imenu--refresh)
        ("<return>" . lsp-ui-imenu--visit))
  :custom
  ;; more code here)

The only breaking change is M-RET vs RET. The others can be added to the existing bindings with no conflict.

Finally, when displaying the window, it shouldn't call display-buffer-in-side-window directly. I have side windows with 0.4 size (for 40% of the screen) but if I display imenu first then next side windows are narrower than usual because lsp-ui-imenu already set a different size. And I cannot re-position the window via display-buffer-alist either.