refactor!(format): simplify & gate lsp/eglot impl behind +lsp

BREAKING CHANGE: This commit introduces two changes, a breaking, one
not.

The breaking change: `+format-with-lsp` used to control lsp-mode/eglot
integration for this module, but it is now gated behind a new +lsp flag.
Users will need to add it to their `doom!` blocks (in $DOOMDIR/init.el)
to restore the integration.

The other change: I've merged the former `lsp` and `eglot` formatters
into a single `lsp` formatter that dispatches to the appropriate
backend, as well as wrapping this integration in a
`+format-with-lsp-mode` minor mode, so it can be toggled at will; mainly
to assist in debugging formatter behavior.

A unified formatter makes it easier for folks to configure
`+format-with` on a per-project/directory/file basis, without needing to
know what backend this module uses, and opens us up to integrating other
LSP backends in the future (like lsp-bridge).
This commit is contained in:
Henrik Lissner 2024-07-07 20:44:33 -04:00
parent cca40c0277
commit fd1941b95f
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 70 additions and 59 deletions

View file

@ -27,6 +27,9 @@ be formatted and returned to the buffer using
Enable reformatting of a buffer when it is saved. See
[[var:+format-on-save-disabled-modes]] to disable format on save for certain
major modes.
- +lsp ::
Use ~lsp-mode~'s or ~eglot~'s formatters, instead of Apheleia's, if the active
client has the capabilities.
** Packages
- [[doom-package:apheleia]]