Commit Graph

164 Commits

Author SHA1 Message Date
081231b73f fix(format): apheleia doesn't invoke lsp formatter
change `+format--lsp-fn` to run `+format--lsp-fn` in context of main
buffer rather than apheleia's scratch buffer so that the lsp mode can
be discovered
2024-07-08 21:41:39 -04:00
dfe9d572a7 docs(format): hacks: mention save-buffer advice 2024-07-08 13:59:16 -04:00
7d25ba3f6c fix(format): void function +format-with-lsp-maybe-h error
Regression introduced in fd1941b.

Amend: fd1941b95f
2024-07-08 13:59:06 -04:00
6b526b1b47 refactor(format): +format/org-block: make arg optional 2024-07-07 21:48:17 -04:00
f104f10c5b docs(format): revise README.org
To reflect recent changes and for clarity.
2024-07-07 21:48:17 -04:00
fd1941b95f 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).
2024-07-07 21:43:27 -04:00
cca40c0277 tweak(format): doom-debug-variables: add apheleia-log-debug-info 2024-07-07 21:43:27 -04:00
d648bfda40 docs(format): revise docstrings and comments 2024-07-07 20:41:03 -04:00
c5c7f0bc99 feat(format): add +format-inhibit alias
I want both `apheleia-formatter` and `apheleia-inhibit` exposed for easy
setting from directory/file-local variables (like .dir-locals.el), but
I'd like to abstract away the implementation (Apheleia) a little, hence
these aliases. This way, whether or not we're still using Apheleia in a
year or three, `+format-with` and `+format-inhibit` should always work.
2024-07-07 16:31:24 -04:00
5e78ed0911 refactor(format): use eglot-server-capable
eglot--server-capable was deprecated.
2024-07-07 14:39:50 -04:00
deb59ca4ad fix(format): LSP formatters before Apheleia is loaded 2024-07-07 14:39:27 -04:00
21a427c33b fix(format): eglot-managed{,-mode}-hook hook 2024-07-06 21:18:34 -04:00
17d4aaace3 fix(format): add lsp functions
Forgot to include these functions in 8072762. Oops.

Amend: 8072762de8
2024-07-06 21:03:12 -04:00
8072762de8 refactor(format): redesign module
Rather than wrap Apheleia in custom formatting logic, I now use
Apheleia's own machinary to integrate into LSP and Eglot, which is less
complexity to maintain. It also makes settings +format-with a more
reliable option for per-project or per-file configuration.

This also adds a +format/org-src-block command, which I'll incorporate
into the org module in a follow-up commit.

Ref: #7685
2024-07-06 19:54:55 -04:00
a3a0629e03 bump: :editor
doomemacs/snippets@c1384cc797 -> doomemacs/snippets@3a0b029c5d
emacs-evil/evil-collection@ca977acb83 -> emacs-evil/evil-collection@acb056b1d0
emacs-evil/evil@0251080640 -> emacs-evil/evil@0ad84c5216
emacs-straight/adaptive-wrap@70005d2012 -> emacs-straight/adaptive-wrap@a3b179ea21
emacs-tree-sitter/ts-fold@0627723e5f -> emacs-tree-sitter/ts-fold@6ce584d1ac
emacsmirror/visual-fill-column@5e74afe39d -> emacsmirror/visual-fill-column@e04d3521b6
joaotavora/yasnippet@297546f085 -> joaotavora/yasnippet@eb5ba2664c
juliapath/evil-numbers@7a1b62afc1 -> juliapath/evil-numbers@c789989451
justinbarclay/parinfer-rust-mode@e9a23e136b -> justinbarclay/parinfer-rust-mode@a96c768e9d
magnars/multiple-cursors.el@234806c832 -> magnars/multiple-cursors.el@c870c18462
radian-software/apheleia@96a9805ecb -> radian-software/apheleia@61766b50b2
2024-06-22 18:14:05 -04:00
b405225b90 refactor!(vc-gutter): drop git-gutter for diff-hl
BREAKING CHANGE: This removes git-gutter as an implementation for the
`:ui vc-gutter` module, leaving only the diff-hl implementation. There
are no longer any +git-gutter or +diff-hl flags for this module. Users
don't have to do anything to keep the vc gutter, unless they prefer
git-gutter for any reason (in which case they'll need to install and set
it up themselves).

This has been planned for some time, because of a roadmap goal for Doom
to lean into native/built-in functionality where it's equal or better
than the third party alternatives. diff-hl relies on the built-in vc.el
library instead of talking to git directly (thus expanding support to
whatever VCS's vc.el supports, and not git alone), which also means it
can take advantage of its caching and other user configuration for
vc.el. Overall, it is faster and lighter.

What I've also been waiting for was a stage-hunk command, similar to
git-gutter:stage-hunk, which arrived in dgutov/diff-hl@a0560551cd and
dgutov/diff-hl@133538973b, and have evolved since.

Ref: dgutov/diff-hl@a0560551cd
Ref: dgutov/diff-hl@133538973b
Ref: https://github.com/orgs/doomemacs/projects/5/views/1?pane=issue&itemId=58747789
2024-06-22 18:14:04 -04:00
5cc4056abf fix(format): +format-with-eglot-fn: eglot detection 2024-03-13 01:00:38 -04:00
5c7149da67 docs(format): +format-in-org-src-blocks-fn: add docstring 2024-02-17 07:13:39 -05:00
1e8fd09120 fix(format): +format-in-org-src-blocks-fn
Didn't return non-nil, so whether or not it worked, Apheleia would
attempt to (ineffectually) format the org buffer afterwards.

Also remove unneeded beg/end checks (the functions always receive a
value).
2024-02-17 07:13:39 -05:00
9ba6d7191c refactor(format): improve lsp/eglot formatter dispatchers 2024-02-14 18:12:22 -05:00
e9ea3cc591 feat(format): add eglot support
Fix: #7673
2024-02-14 18:12:22 -05:00
20de3d0f29 refactor(format): introduce +format-functions 2024-02-14 18:12:22 -05:00
e701522d68 bump: :editor
doomemacs/snippets@d490cba6d7 -> doomemacs/snippets@f022984ee1
emacs-straight/adaptive-wrap@fc9f0306f1 -> emacs-straight/adaptive-wrap@70005d2012
emacs-tree-sitter/ts-fold@75e72c658a -> emacs-tree-sitter/ts-fold@0627723e5f
joaotavora/yasnippet@5cbdbf0d20 -> joaotavora/yasnippet@297546f085
joostkremers/visual-fill-column@695a597892 -> joostkremers/visual-fill-column@db7c7c2365
justinbarclay/parinfer-rust-mode@6e6bdeeba3 -> justinbarclay/parinfer-rust-mode@8df117a3b5
raxod502/apheleia@56651724ad -> raxod502/apheleia@96a9805ecb
2024-02-04 19:18:24 -05:00
659f7bfc71 refactor!: deprecate IS-* OS constants
BREAKING CHANGE: This deprecates the IS-(MAC|WINDOWS|LINUX|BSD) family
of global constants in favor of a native `featurep` check:

  IS-MAC      ->  (featurep :system 'macos)
  IS-WINDOWS  ->  (featurep :system 'windows)
  IS-LINUX    ->  (featurep :system 'linux)
  IS-BSD      ->  (featurep :system 'bsd)

The constants will stick around until the v3 release so folks can still
use it -- and there are still some modules that use it, but I'll phase
those uses out gradually.

Fix: #7479
2024-02-04 17:54:29 -05:00
9a1022ef08 bump: :editor format
radian-software/apheleia@c222927f70 -> radian-software/apheleia@56651724ad

fbd00b6 changes aphelia-core to aphelia, but only in 1 out of 2 places
and this is not the correct name in the version pinned in doom.

Fix: #7568
Amend: fbd00b6a08
2023-11-29 11:27:06 -05:00
fbd00b6a08 fix(format): correct name of feature 2023-11-27 09:37:11 -05:00
c076b1237f docs(format): reasoning for using +format/buffer 2023-11-27 09:37:11 -05:00
9da33cf9e7 docs(format): describe interaction between +onsave and LSP 2023-11-27 09:37:11 -05:00
9d8f657b37 refactor(format): describe what hook does 2023-11-27 09:36:58 -05:00
85d20f71ca docs(format): fix name of doom-package 2023-11-27 09:36:58 -05:00
9b718f8a5a docs(format): document +format-on-save-disabled-modes in README 2023-11-27 09:36:58 -05:00
cdbf97b4e9 fix(format): align behaviour and documentation
`+format-on-save-disabled-modes` documentation was referencing behaviour
that no longer exists, as well as documenting behaviour that was not
implemented.
2023-11-27 09:36:58 -05:00
a4d95674ec tweak(format): doom-debug-variables: add apheleia-log-only-errors 2023-09-20 20:23:59 +02:00
cdbf58a871 refactor(format): swap to string-blank-p & memq 2023-09-20 20:23:59 +02:00
88bb045388 docs(*): replace all-the-icons with nerd-icons
Also colorizes the leading icon in notices.
2023-09-16 20:19:11 +02:00
aab5215951 fix(format): use +vc-gutter-update-h instead
+vc-gutter-init-maybe-h is not defined when using +diff-hl so instead
let's use +vc-gutter-update-h to refresh the VC gutter.
2023-09-16 05:00:25 +02:00
e44508f67c docs(format): improve note about regional formatting 2023-09-15 20:38:29 +02:00
7920b0d46c fix(format): update missing values & set buffer modification
This prevents apheleia complaining about the editing buffer being
killed.

Co-authored-by: Wang Liao <lwlw1988@gmail.com>
2023-09-15 20:38:29 +02:00
3191349182 docs(format): set-formatter!: escape quotes in docstring 2023-09-14 20:17:24 +02:00
0b2e6d7070 docs(format): clarify how to update macro in private config 2023-09-14 20:06:51 +02:00
dd68bbb7da fix(format): removed unused argument 2023-09-13 20:21:08 +01:00
ce93f899fd fix(format): improve function/module loading safety 2023-09-13 20:21:08 +01:00
249a39acb4 fix(format): pin apheleia 2023-09-13 20:21:07 +01:00
12d520a377 fix(format): remove merged formatter 2023-09-13 20:21:07 +01:00
b0e579741e fix(format): react to ns change 2023-09-13 20:21:07 +01:00
550767efe2 fix(format): apheleia-inhibit-functions after load 2023-09-13 20:21:07 +01:00
b34533de96 fix(format): load format-on-save-disabled-modes fn
Should handle some corner cases with how inhibiting is set
2023-09-13 20:21:07 +01:00
926b8f1328 docs(format): redo docs to handle refactor 2023-09-13 20:21:07 +01:00
457aeeccc0 fix(format): better handle format-on-save disable 2023-09-13 20:21:07 +01:00
dc3b5c3710 fix(format): handle git-gutter nicely 2023-09-13 20:21:01 +01:00