Commit Graph

1618 Commits

Author SHA1 Message Date
Henrik Lissner
1dae2bf916 fix(tree-sitter): remap to ts-mode w/o base mode
If the base major mode doesn't exist, let's assume we want no
fallthrough for this major mode (in the event the grammar isn't ready)
and simply push forward anyway, even if a missing grammar results in a
broken state.

This will particularly affect major modes like `typescript-mode` (which
simply won't be installed if +tree-sitter is enabled) and
`go-{mod,work}-ts-mode` (for which no base major modes exist).

The difference (generally) between most base and ts-modes is
performance, not features, so "gracefully failing back to the base mode"
makes sense UX-wise, but `typescript-mode` notably inferior to
`typescript-ts-mode` (particularly in its TSX support). Beginners may
misidentify its shortcomings as bugs, so it's better to simply error out
early so the user can be made aware of the problem sooner and less
ambiguously.
2025-08-31 16:20:14 +02:00
Henrik Lissner
5cda3ed25a merge: branch 'feature/treesit'
Fix: #7742
Fix: #7623
Fix: #7593
2025-08-31 14:55:37 +02:00
Henrik Lissner
94a1fe64a8 fix(tree-sitter): suppress "Can't find grammar" warnings
In Emacs <=30, top-level `treesit-ready-p` calls in various *-ts-mode
packages (like lua-ts-mode or ruby-ts-mode) are commonplace, and they
throw up a warning popup if the grammar isn't available at load time.
This is intrusive. Instead, this forces it to log to *Messages* instead
before falling back to the normal major mode.

Fortunately, these top-level `treesit-ready-p` calls have been removed
in most *-ts-mode packages in 31+, but this still impacts users on <=30
or using third party *-ts-modes that haven't adapted.

However, this doesn't suppress the warning when opening a *-ts-mode.el
file (thanks to the byte-compiler).
2025-08-31 14:41:40 +02:00
Henrik Lissner
d545fccf47 fix(:lang): missing grammar recipes
I removed the grammar recipes in 3b58741 to avoid redundancy with the
upstream recipes, but didn't realize that those upstream recipes weren't
added until Emacs 31, so users on 30 and older would get errors when
trying to install any missing grammars.

This also establishes a hard dependency between :lang (php +tree-sitter)
and :lang ({javascript,web} +tree-sitter).

Amend: 3b58741522
2025-08-31 14:39:38 +02:00
Henrik Lissner
d9fd5cb8f3 fix(tree-sitter): treesit-enabled-modes: sort arity in <30
`sort`s signature changed in Emacs 30 from:

  (sort SEQ PREDICATE)

To

  (sort SEQ &key KEY LESSP REVERSE IN-PLACE)

Amend: 6009c2b838
2025-08-31 14:34:45 +02:00
Henrik Lissner
7dcedc16b5 refactor(tree-sitter): major mode remapping
This approach simplifies the hacks and uses fewer moving parts to be
less error prone (or prone to potentially overwriting user/module
configuration).
2025-08-30 09:41:25 +02:00
Henrik Lissner
702d976665 docs(tree-sitter): document module hacks 2025-08-29 14:37:10 +02:00
Henrik Lissner
cd5dd5279e fix(tree-sitter): major mode remapping on first-load
Also refactors +tree-sitter--major-mode-remaps-alist to be lighter.
2025-08-29 14:35:49 +02:00
Henrik Lissner
bd0bee92cc feat!(javascript): add treesit support
BREAKING CHANGE: This commit removes a number of core packages and
features from this module and only replaces a handful of them, so that
we can lean more on LSP and tree-sitter. To be specific:

- We used to rely on `rjsx-mode` (derived from js2-mode) for total
  JS/JSX support (though imperfect; Emacs was starved for options at the
  time). This has now been replaced with `js-ts-mode` (built-in after
  Emacs 29), falling back to `js-mode` (very rudimentary, but a decent
  fallback).
- This also meant the removal of `js2-mode`, which `skewer-mode`,
  `js2-refactor`, and `xref-js2` depended on, so those were removed
  too, and have *somewhat* been replaced with LSP integration (offers
  jump-to-definition/references and *some* refactoring actions, but no
  replacement for skewer's functionality).
- Typescript support no longer relies on the jury-rigged, web-mode-derived
  major mode (because TSX support in the upstream `typescript-mode`
  isn't great). We now use `typescript-ts-mode` (built-in into Emacs
  29.1+), falling back to `typescript-mode`.
- JSX/TSX support now *requires* tree-sitter (and Emacs 29.1+), where
  `tsx-ts-mode` is available and outshines all the alternatives (at the
  time of writing).

Due to the absolute chaos that is webdev, this module sacrifices some of
the graceful-degradation I've implemented for other modules and creates
a hard requirement on tree-sitter and Emacs 29.1+ for JSX/TSX. It still
tries to degrade gracefully for plain JS and TS, but the module's doctor
and docs will actively recommend tree-sitter.

Close: #5278
Fix: #6172
Fix: #7042
Close: #8447
Co-authored-by: ribaricplusplus <ribaricplusplus@users.noreply.github.com>
2025-08-29 14:35:49 +02:00
Henrik Lissner
64b4e565c3 refactor(tree-sitter): remove redundant grammars
Already registered by csharp and web module packages.

Amend: 5bf132a80f
Amend: c403bb5e2f
2025-08-28 14:32:08 +02:00
Henrik Lissner
3b58741522 refactor(tree-sitter): centralize grammar config & hacks
Easier to track and maintain.
2025-08-27 16:57:28 +02:00
Henrik Lissner
6009c2b838 fix(tree-sitter): backport treesit-{enabled-modes,major-mode-remap-alist}
And ignore `treesit-major-mode-remap-alist`, because they could
interfere with our UX improvements.
2025-08-23 18:43:14 +02:00
Henrik Lissner
cde7dbbb0f fix(lsp): eglot-booster-io-only only when needed
On older Emacsen, we want all the help eglot-booster can give.

Ref: #8463
Amend: 1ede94c88a
2025-08-21 16:47:37 +02:00
Henrik Lissner
79c8621091 fix(lsp): disable lsp-mode + emacs-lsp-booster advice
This is temporary until a better solution is found.

This advice does nothing for lsp-mode without the accompanying
`jsonrpc--json-read` advice eglot-booster uses. Needs more testing to
make sure it's worth the trouble on Emacs 30+ and is compatible with
`lsp-use-plists`.

Ref: #8463
Amend: 1ede94c88a
2025-08-21 16:46:37 +02:00
Henrik Lissner
c7d5ad622e docs(lsp): mention +booster
Ref: #8463
2025-08-21 16:33:33 +02:00
Henrik Lissner
c2da4f20f2 refactor(lsp): eglot-booster: conform to conventions
Ref: #8463
Amend: 1ede94c88a
2025-08-21 15:45:15 +02:00
Sergei Nizovtsev
1ede94c88a feat(lsp): add +booster flag
Adds support for LSP IO performance booster. This may reduce UI-blocking
time in case of unresponsive LSP backend.
2025-08-21 14:46:55 +02:00
Henrik Lissner
09e5bc9ecc bump: :tools
NicolasPetton/pass@896696999d -> NicolasPetton/pass@7651389c52
Silex/docker.el@464105ed8b -> Silex/docker.el@91233a7c55
andras-simonyi/citeproc-el@d232616851 -> andras-simonyi/citeproc-el@f36650536b
editorconfig/editorconfig-emacs@d2beb3ec2e -> editorconfig/editorconfig-emacs@f85ec9724b
emacs-ansible/emacs-ansible@8474bd186b -> emacs-ansible/emacs-ansible@7385222a4f
emacs-lsp/lsp-mode@3a96df0dd7 -> emacs-lsp/lsp-mode@65a414ddeb
emacs-lsp/lsp-ui@a0dde8b52b -> emacs-lsp/lsp-ui@bbb1aa0192
emacs-straight/dape@1df7834306 -> emacs-straight/dape@411e4b6126
emacs-straight/eglot@6a9e0c76b9 -> emacs-straight/eglot@a8cb16b833
emacs-tree-sitter/elisp-tree-sitter@1c455b0953 -> emacs-tree-sitter/elisp-tree-sitter@caeb32e8a7
emacs-tree-sitter/tree-sitter-langs@59979a1f5c -> emacs-tree-sitter/tree-sitter-langs@9b7e508435
flycheck/flycheck-eglot@18d0c98695 -> flycheck/flycheck-eglot@0d7f0afc9b
karthink/gptel@0a77446108 -> karthink/gptel@af821efe63
magit/magit@2f1ff91f12 (4.3.6) -> magit/magit@5b820a1d1e (4.3.8)
magit/transient@f3f498aa15 (0.9.2) -> magit/transient@aa32e0d66c (0.9.4)
meain/evil-textobj-tree-sitter@bce236e5d2 -> meain/evil-textobj-tree-sitter@4ca5dffbd3
nicolaisingh/saveplace-pdf-view@79e76562bc -> nicolaisingh/saveplace-pdf-view@dc1e0b28a5
purcell/envrc@cb5f6d2a42 -> purcell/envrc@510807ae96
zx2c4/password-store@b5e965a838 -> zx2c4/password-store@3ca13cd888

Close: #8453
2025-08-10 15:34:44 +02:00
Henrik Lissner
d63a15eba7 fix(lsp): shutdown deferral for multiple LSP clients
If a buffer had multiple LSP servers active,
`+lsp-defer-server-shutdown-a` would only shut down the first. This
adjusts it to not only defer shutdown of all servers, but also ensures
`+lsp-optimization-mode` is only disabled when there are no lsp-mode
sessions left.

Fix: #5409
2025-08-09 23:00:03 +02:00
Henrik Lissner
000bf3beea docs(magit): add 29.1+ check for +forge
Was supposed to be in aa7dd61. Oops.

Amend: aa7dd61a2c
2025-06-30 15:23:27 +02:00
Henrik Lissner
2adbdf1360 feat(clojure): add treesit support 2025-06-30 15:16:26 +02:00
Henrik Lissner
7949d1bf27 fix(tree-sitter): void-variable +tree-sitter--major-mode-remaps-alist
This is a temporary solution and will be polished up before the treesit
branch is merged into master.

Ref: #7623
Amend: 617d8411e6
2025-06-30 14:48:54 +02:00
Henrik Lissner
a8ccd2d47a fix(tree-sitter): unable to find local grammars (part 2)
Ref: #7623
Amend: 4df993d683
2025-06-30 14:47:35 +02:00
Henrik Lissner
0d9cf54c84 refactor(tree-sitter): remove redundant dart grammar
Amend: a287a96aca
2025-06-28 21:17:15 +02:00
Henrik Lissner
7c6e1950e8 feat(go): add treesit support 2025-06-28 20:10:08 +02:00
Henrik Lissner
617d8411e6 fix(tree-sitter): ignore major-mode-remap-defaults for ts modes
...registered with `set-tree-sitter!`. Then we don't have to chase after
packages inconsistently modifying `major-mode-remap-defaults`.
2025-06-28 19:32:27 +02:00
Henrik Lissner
4df993d683 fix(tree-sitter): unable to find local grammars
Ref: #7623
2025-06-28 17:37:24 +02:00
pancho horrillo
bffc593b9f bump: ghub
magit/ghub@HEAD -> magit/ghub@97a07691ef (4.3.2)

ghub is in a state of flux right now, with some parts being split into
their own packages¹. The latest ghub release (4.3.2)² is just three weeks old,
so I think we are fine just pinning that one.

¹: 3e7ad9d138/CHANGELOG (v500----unreleased)
²: https://github.com/magit/ghub/releases/tag/v4.3.2

Fix: #8421
Ref: magit/ghub@30e57b2
2025-06-26 02:36:19 +02:00
Henrik Lissner
197419f041 fix(magit): +forge: fail gracefully on <29.1
Amend: aa7dd61a2c
2025-06-12 17:10:25 +02:00
Henrik Lissner
aa7dd61a2c fix(magit): require Emacs 29.1+ for +forge
Forge depends on ghub, and ghub requires 29.1+, so Forge has dropped
backwards compatibility (plus, code-review depends on Forge).

Also adds a doctor check for this constraint.

Fix: #8419
Ref: magit/forge@35224e5dd4
2025-06-12 14:43:03 +02:00
Henrik Lissner
f96af872ac bump: :tools
NicolasPetton/pass@1a9f610015 -> NicolasPetton/pass@896696999d
andras-simonyi/citeproc-el@54184baaff -> andras-simonyi/citeproc-el@d232616851
emacs-lsp/lsp-mode@c77ba14106 -> emacs-lsp/lsp-mode@3a96df0dd7
emacs-straight/dape@8dbe56d7c7 -> emacs-straight/dape@1df7834306
emacs-tree-sitter/tree-sitter-langs@becd29c756 -> emacs-tree-sitter/tree-sitter-langs@59979a1f5c
hcl-emacs/terraform-mode@5bdd734a87 -> hcl-emacs/terraform-mode@80383ff42b
jacktasia/dumb-jump@737267a613 -> jacktasia/dumb-jump@42f97dea50
magit/forge@9db4d386a1 -> magit/forge@a31859547a
magit/magit@04ee83d93f -> magit/magit@2f1ff91f12
magit/transient@25b994a565 -> magit/transient@f3f498aa15
mohkale/consult-eglot@b71499f4b9 -> mohkale/consult-eglot@2816f8aad7
purcell/envrc@4ca2166ac7 -> purcell/envrc@cb5f6d2a42
2025-06-11 01:29:52 +02:00
Henrik Lissner
68010af090 bump: :tools llm
karthink/gptel-quick@34acd437a7 -> karthink/gptel-quick@495b5e0b53
karthink/gptel@e1050ef6e5 -> karthink/gptel@0a77446108
ragnard/gptel-magit@7f58694304 -> ragnard/gptel-magit@f27c01821b

Ref: karthink/gptel#848
Close: #8415
Co-authored-by: markflarup <markflarup@users.noreply.github.com>
2025-06-10 21:29:00 +02:00
Jaume Delclòs Coll
d60d639efe fix(magit): Remove +magit-optimize-process-calls-h 2025-06-10 21:23:00 +02:00
Henrik Lissner
c1632fa887 fix(debugger): don't persist breakpoints
Leave it to users to implement this, if they want this, but not only
might it cause confusion, but users may want a clean slate every time
they launch a new debugging session in the same project.

Fix: #8407
2025-06-02 14:19:26 +02:00
Henrik Lissner
5b37bfee23 feat(nix): add treesit support 2025-05-24 17:27:30 +02:00
Henrik Lissner
3b2caa7dcd feat(docker): add treesit support 2025-05-24 17:11:40 +02:00
Henrik Lissner
7af7280f9e feat(json): add treesit support 2025-05-22 19:53:10 +02:00
Henrik Lissner
f5a1af4bf6 feat(kotlin): add treesit support 2025-05-22 19:50:29 +02:00
Henrik Lissner
c5dd2847ff feat(scala): add treesit support 2025-05-22 19:50:29 +02:00
Henrik Lissner
5db361b474 fix(tree-sitter): remove redundant yaml source
Amend: 2556cb58f2
2025-05-22 18:32:04 +02:00
Henrik Lissner
0c311a5172 feat(elixir): add treesit support 2025-05-22 18:32:03 +02:00
Henrik Lissner
11b4b8d2e5 revert: transient
magit/transient@HEAD -> magit/transient@25b994a565

Seems to be a source of many issues the past month or so. About time we
pin it by stable release.

Fix: #8394
2025-05-18 00:35:24 +02:00
Henrik Lissner
bd908e4c47 revert: eglot
emacs-straight/eglot@0b0f894713 -> emacs-straight/eglot@6a9e0c76b9

I incorrectly believed that #8380 was resolved upstream, but it hasn't,
therefore this revert is necessary to avoid Eldoc errors on the latest
commit of Eglot.

Amend: 50200762cd
Ref: 13e92ceb3c
Ref: #8380
2025-05-16 09:28:29 +02:00
Henrik Lissner
a329d63f7d fix(tree-sitter): discard COMMIT recipe argument on <=30.x
Otherwise `treesit--install-language-grammar-1` will throw an arity
error on Emacs <=30.x when installing grammars.

Fix: #8393
2025-05-16 08:49:20 +02:00
Henrik Lissner
78f55f3a45 fix(magit): update diff-hl on revert
Not a complete fix, because +vc-gutter-update-h isn't aggressive or
responsive enough to changes in VC in buffers that haven't changed, but
I'll address that later.
2025-05-15 19:35:06 +02:00
Henrik Lissner
b546522257 docs(tree-sitter): revise doctor output 2025-05-15 18:58:29 +02:00
Henrik Lissner
1670ce2767 feat!(cc): add treesit support
BREAKING CHANGE: Besides treesit support, this removes a few
fontification enhancements (in favor of tree-sitter).
2025-05-15 13:01:40 +02:00
Henrik Lissner
46b87362f7 feat(julia): add treesit support 2025-05-15 13:01:40 +02:00
Henrik Lissner
f002424106 feat(lua): add treesit support 2025-05-15 13:01:40 +02:00
Henrik Lissner
445c982838 feat(ruby): add treesit support 2025-05-15 13:01:40 +02:00