gagbo / consult-lsp

LSP-mode and consult.el helping each other
MIT License
96 stars 11 forks source link

+TITLE: Consult LSP-mode integration

+AUTHOR: Gerry Agbobada

+LANGUAGE: en

+HTML: MELPA

+HTML: MELPA Stable

They tend not to be updated as often as changes happen, sorry if there are slight differences in UI. Those shots are more about giving an idea of what's happening.

+caption: consult-lsp-diagnostics

[[https://github.com/gagbo/consult-lsp/blob/screenshots/media/consult-lsp-diagnostics.png?raw=true]]

+caption: consult-lsp-symbols

[[https://github.com/gagbo/consult-lsp/blob/screenshots/media/consult-lsp-symbols.png?raw=true]]

+caption: consult-lsp-file-symbols

[[https://github.com/gagbo/consult-lsp/blob/screenshots/media/consult-lsp-file-symbols.png?raw=true]]

There is currently no plan to add an interface to list and/or act on code-actions, but contributions are welcome!

This package provides 2 entry points per command in order to customize the appearance of candidates in the selection/completion interface. This is mostly for advanced users who are somewhat familiar with consult API:

You are encouraged to take a look at the default values if you wish to customize these, especially the file-symbols one, which is probably the easiest ones to grok, and use marginalia.

** Keys *** Categories for symbols =consult-lsp-symbols= and =consult-lsp-file-symbols= can have the set of "narrow" keys you like by customizing =consult-lsp-symbols-narrow=.

The ~cdrs~ of the alist must match the symbol types returned by LSP servers, AND have an "Other" key for everything that is not included.

You can find categories by looking for the [[https://microsoft.github.io/language-server-protocol/specification.html#textDocument_documentSymbol][SymbolKind enum]] in the LSP specification.

*** Bindings As you can do with helm-lsp,

Use the following line to replace xref-find-apropos in lsp-mode controlled buffers:

+begin_src emacs-lisp

(define-key lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols)

+end_src