README.org
May 31, 2025 ยท View on GitHub
#+TITLE: consult-eglot #+AUTHOR: Mohsin Kaleem
#+html:
#+html:
#+html:
#+html:
#+html:
A [[https://github.com/minad/consult][consult]]ing-read interface for [[https://github.com/joaotavora/eglot][eglot]].
This package acts as a parallel of [[https://github.com/gagbo/consult-lsp][consult-lsp]] for eglot and provides a front-end
interface for the workspace/symbols LSP procedure call.
#+CAPTION: Obligatory screenshot of consult-eglot in action. [[https://user-images.githubusercontent.com/23294780/131529081-7b6ad89a-98c8-40f2-9ef8-184856f8e9ef.png]]
- Table of Contents :TOC:
- [[#installation][Installation]]
- [[#manually][Manually]]
- [[#from-melpa][From MELPA]]
- [[#extensions][Extensions]]
- [[#consult-eglot-embark][Consult Eglot Embark]]
- Installation
** Manually
- Clone the repo.
- Add the repo path to your emacs
load-path. - Load it when needed.
** From MELPA
This package is on [[https://github.com/melpa/melpa][MELPA]]. You can add this to your package-archives variable and
then install through M-x package-install.
#+begin_src emacs-lisp (push '("melpa" . "https://melpa.org/packages/") package-archives) (package-refresh-contents) (package-install 'consult-eglot) #+end_src
- Usage
consult-eglotprovides one interactive function:consult-eglot-symbols, that usescompleting-readto filter symbols from your workspace.
By default, it shows matches across your whole project according to the LSP server's =workspace/symbol= output. (Naturally, if your LSP server of choice doesn't support that feature, consult-eglot won't work.)
** Narrowing
To not show any and all textual matches, narrow down the kind of symbol that is being matched using [[https://github.com/minad/consult?tab=readme-ov-file#narrowing-and-grouping][=consult='s narrowing feature]]. Start your completing-read minibuffer prompt with one of the consult-narrow-key symbols as defined in the consult-eglot-narrow alist.
To explore these during completing-read, it's a good idea to execute =M-x consult-narrow-help= during completing-read, or create a key binding for easy access.
Examples:
- =M-x consult-eglot-symbols v foo= will narrow to variables (=v=) that match "=foo="
- =M-x consult-eglot-symbols M bar= will narrow to methods (=M=) that match "=bar="
-
Extensions ** Consult Eglot Embark Adds support for embark exports and action overrides to consult-eglot searches.
#+begin_src emacs-lisp (package-install 'consult-eglot-embark) (with-eval-after-load 'embark (with-eval-after-load 'consult-eglot (require 'consult-eglot-embark) (consult-eglot-embark-mode))) #+end_src