158 Commits

Author SHA1 Message Date
Christian Clason
2b50ab5ccb test: replace plenary with plentest.nvim
Problem: plenary.nvim as test runner is overkill and no longer
maintained.

Solution: Replace with a minimal fork based on Neovim API and vendored
luassert.
2026-03-17 18:20:03 +01:00
Christian Clason
ac1d0ff910 fix(scripts): guard against empty reply when checking new revisions 2026-01-31 11:07:03 +01:00
Christian Clason
0ac55b85c6 refactor(lua): replace vim.opt with vim.o 2026-01-27 11:57:04 +01:00
Christian Clason
b9933f0e13 test(init): remove upstreamed Tiger ft detection 2026-01-19 10:37:35 +01:00
Christian Clason
2ba5ec1846 test(init): remove upstreamed Nickel ft detection 2026-01-08 10:34:30 +01:00
Christian Clason
e0eec76dad fix(lua): fix some emmyluals warnings 2025-12-06 11:16:30 +01:00
Christian Clason
0cfa599474 chore: remove format-queries script
The source of truth for formatting (according to make formatquery and
 CI) is now ts_query_ls, so remove the no longer required script to
 prevent divergence and bitrotting.
2025-11-14 22:58:12 +01:00
Christian Clason
fd2880e8bc feat(install): remove node requirement
* supported parsers _must_ commit at least `grammar.json`
* set `TREE_SITTER_JS_RUNTIME=native` when generating parser to use
  built-in quickjs instead of node (requires tree-sitter 0.26)
2025-10-30 08:36:00 +01:00
Christian Clason
2e8f8562e6 fix(scripts): sort list of updated parsers 2025-06-29 11:39:30 +02:00
Christian Clason
01dd4b05cf fix(check-queries): only show timings for existing queries 2025-05-30 16:23:44 +02:00
Christian Clason
ff770d718b fix(install): don't print operation summary by default
Problem: People complain about noisy `install()`.

Solution: Gate operation summary behind `summary` install option
(default false, set to true for interactive `:TS*` commands).
2025-05-29 20:08:10 +02:00
Christian Clason
ce903fde5d feat(api): expose list of available and installed languages 2025-05-29 12:11:56 +02:00
Christian Clason
0860b9b107 fix(config): check both installed parsers and queries
Problem: Can't uninstall custom parsers without queries since
`installed_parsers` only iterates over installed queries (to include
query-only languages, and to avoid string manipulation).

Solution: Iterate over both queries and parsers to collect list of
installed languages (optionally only queries or only parsers).
2025-05-29 11:52:58 +02:00
Christian Clason
61b0a05ec0 fix(install): create cache dir if not existing 2025-05-26 17:21:18 +02:00
Christian Clason
011f02936f fix(install): return task object in API functions 2025-05-22 08:34:45 +02:00
Lewis Russell
69371f0148 feat(install)!: migrate to latest async.nvim impl (#7856)
Provides significantly simpler blocking installation and update.
2025-05-16 18:33:52 +02:00
Christian Clason
dc8f3415a7 feat!: update tier 1 parsers to versions 2025-05-12 18:43:41 +02:00
Christian Clason
53dccb3a77 feat(tests)!: new infrastructure based on makefile
Problem: Not easy to run all checks and tests locally. Redundant CI
workflows.

Solution: Separate CI into two workflows:
 * lint: Lua files (stylua, luals), query files (valid captures,
   predicates, directives using tsqueryls), docs
   (SUPPORTED_LANGUAGES.md) -- does not need parser installation
 * tests: parsers (ABI compatibility), query files (tsqueryls on
   Linux/macOS; nvim on Windows), highlight and indent tests (separated
   for better readability) -- needs parser installation (but only once)

Switch to https://github.com/nvim-treesitter/highlight-assertions fork
with ABI 15 support.

Run all tests (on Linux and macOS) through `make` (`formatlua`,
`checklua`, `lintquery`, `formatquery`, `checkquery`, `docs`, `tests`),
which downloads and caches all necessary dependencies.

Remove `update-readme` workflow (replaced by lint job on PRs).
2025-05-12 18:43:41 +02:00
Christian Clason
44bb06bc12 chore: remove lockfile and update script
`main` branch and `parsers.lua` is the record of truth now
2025-05-12 18:43:40 +02:00
Christian Clason
53d7118483 refactor(lua): fix some luals warnings 2025-05-12 18:43:40 +02:00
Christian Clason
bdc2e01958 feat(install)!: always generate from json if possible 2025-05-12 18:43:40 +02:00
Christian Clason
522e0c6991 feat(setup)!: remove ensure_install field
Instead, call `require('nvim-treesitter').install( { ... } )` manually.

This gives users full control over how they want to install parsers
(sync, from grammar, limited concurrency) and obviates the need for
calling `setup` for most users.
2025-05-12 18:43:40 +02:00
Christian Clason
12e0246e4f fix(formatter): increase match limit
Problem: Some very long patterns were not formatted correctly.

Solution: Increase the match limit when iterating to 1024.
2025-05-12 18:43:40 +02:00
przepompownia
6fe0032640 feat(install): allow pass callback to update()
Problem: cannot run `:TSUpdate synchronously`

Solution: pass callback used after exiting jobs
(like in `install-parsers`).
2025-05-12 18:43:40 +02:00
Christian Clason
a9f34d5a76 feat(parsers): rework tiers
* stable: updates follow semver releases (todo)
* unstable: updates follow HEAD (default)
* unmaintained: no automatic updates
* unsupported: no updates, cannot be installed
2025-05-12 18:43:40 +02:00
Christian Clason
188bbf7a09 fix(ci): update to changed neovim release name 2025-05-12 18:43:40 +02:00
Christian Clason
aaf5b7fdf7 fix(install): return error code in callback 2025-05-12 18:43:40 +02:00
Christian Clason
83dae49a10 feat(install): allow specifying max jobs 2025-05-12 18:43:40 +02:00
Christian Clason
214cfcf851 feat!: use tree-sitter build 2025-05-12 18:43:40 +02:00
Christian Clason
c17de56890 feat!: track parser revision in Lua
Problem: Tracking parser revision in lockfile and allowing override
through the parsers module complicates the code. In addition, only
revision changes are handled robustly, not changes to other installation
info.

Solution: Track parser revision in the parsers module directly. Reload
parser table on every install or update call. Support modifying parser
table in a `User TSUpdate` autocommand.
2025-05-12 18:43:40 +02:00
Christian Clason
5a38df5627 feat(install)!: generate from json instead of requiring node
Problem: Many parsers require node/npm to evaluate the `grammar.js`
before being able to generate a parser from it.

Solution: Generate from `grammar.json` instead, which is fully resolved.
Drops `node` and `npm` as (optional) requirements for nvim-treesitter.

Note that this requires parsers to commit the generated json iff the
grammar requires evaluation (which is currently the case for all tracked
languages).
2025-05-12 18:43:40 +02:00
Phạm Huy Hoàng
039fe9095d fix(format): update scripts to support nightly (#6126)
No need for assert as the use is contained within the script only
2025-05-12 18:43:40 +02:00
Christian Clason
885c2960ef fix: better output for update-lockfile 2025-05-12 18:43:40 +02:00
Christian Clason
e77506bde3 feat: improve check-queries 2025-05-12 18:43:40 +02:00
Christian Clason
bae77b87b1 feat: add parser tiers
Tier 1: Stable
Tier 2: Core (maintained by org members)
Tier 3: Community (maintained by external contributors, to varying
degree)
Tier 4: Unsupported (lacking active maintainer or declared
experimental); skipped in lockfile update and ignored for automatic
install by default
2025-05-12 18:43:40 +02:00
Christian Clason
f0a984347c feat!: drop makefile support, norg parser
Norg install_info and queries are maintained by neorg.

All other parsers are compatible with C++11, so fix that as standard.
(Can be bumped if all supported platforms support C++14.)

Remove Makefile support, as it's no longer needed.
2025-05-12 18:43:40 +02:00
Lewis Russell
c5152f3e83 refactor: use vim.system (#4923) 2025-05-12 18:43:40 +02:00
Christian Clason
37957d6bcf refactor: use vim.uv 2025-05-12 18:43:40 +02:00
Christian Clason
cd2c826972 fix: install dependencies 2025-05-12 18:43:40 +02:00
Christian Clason
9c0a99819c ci: remove update-lockfile shell script 2025-05-12 18:43:40 +02:00
Lewis Russell
cde679e435 refactor: rewrite installation using jobs and async
Replace sync variants with callback support
2025-05-12 18:43:40 +02:00
Christian Clason
5aa2984a02 refactor: use vim.fs.joinpath 2025-05-12 18:43:40 +02:00
Christian Clason
5817ff01b5 feat(locals)!: refactor locals.lua into standalone
Co-authored-by: TheLeoP <eugenio2305@hotmail.com>
2025-05-12 18:43:40 +02:00
Christian Clason
692b051b09 feat!: drop modules, general refactor and cleanup 2025-05-12 18:43:40 +02:00
Riley Bruins
53a6b3993f feat(formatter): support formatting missing nodes
This commit makes missing nodes take formatting identical to that of
regular named nodes, with the only exception being that a newline will
not be prepended to a node name. E.g. this pattern:

```query
(MISSING identifier)
```

will *not* be changed to:

```query
(MISSING
  (identifier))
```
2025-02-04 09:56:51 +01:00
Riley Bruins
7194ff9511 fix(formatter): prefer #-prefixed predicates
This prevents the formatter for appending a space after the "." in a
predicate prefix, and changes it to a "#" to match all other occurrences
in the codebase.
2025-02-04 09:56:39 +01:00
Christian Clason
aeaac6a208 fix(ci): fixup 2025-01-30 09:10:34 +01:00
Christian Clason
7d28f8afc4 fix(ci): update to changed neovim release name 2025-01-30 08:53:22 +01:00
Christian Clason
2206739829 ci(install): adapt to new Neovim release artefact names
Old name can be removed after 0.10.4 release
2025-01-27 17:09:08 +01:00
Riley Bruins
a069bb62a8 fix: formatter idempotency for nested groupings (#7345)
Currently, for something like `(((((node))))) @cap`, the formatter will
produce `((node)) @cap`, and then after another pass it will produce
`(node) @cap`. This commit makes it so that all extraneous parentheses
are removed on the first pass.
2024-11-11 11:59:21 +09:00