jdtsmith / kind-icon

Completion kind text/icon prefix labelling for emacs in-region completion
GNU Affero General Public License v3.0
174 stars 4 forks source link

Use kind-icon only in lsp-mode #28

Closed kchousos closed 1 year ago

kchousos commented 1 year ago

Hello! Thank you for this great package.

I recently migrated to using corfu instead of company, and everything seems to be working smoothly. My only problem is that I would prefer kind-icons to be used by corfu only in lsp buffers. Is there an easy way to do that?

Thank you in advance.

jdtsmith commented 1 year ago

Thanks. You could make corfu-margin-formatters into a buffer-local variable and, presumably in some hook like lsp-managed-mode-hook, add kind-icon-margin-formatter to it there. Something like (in a use-package stanza, untested):

   :config
   (defun my/enable-kind-icon ()
     (setq-local corfu-margin-formatters '(kind-icon-margin-formatter)))
   :hook  ((lsp-managed-mode . my/enable-kind-icon))

This arranges it so that only in LSP-MODE buffers would kind-icon-margin-formatter be on the corfu-margin-formatters list.

kchousos commented 1 year ago

This does exactly what I need. Thank you very much for your help and quick reply!