Commit Graph

149 Commits

Author SHA1 Message Date
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
Riley Bruins
674100c1fc fix(formatter): simplify code, remove odd line break 2024-10-26 10:07:30 +02:00
Riley Bruins
58030e6d6f fix(formatter): adapt formatter for nightly
After Neovim pull #30193, the formatter was broken due to changes in the
way node data is passed to predicates.
2024-09-07 17:31:18 +02:00
再生花
929e4739cc fix(format): field_def inside grouping 2024-08-01 08:40:23 +02:00
Christian Clason
a80fe081b4 feat(predicates)!: rename has-type to kind-eq to align with Helix
No point in having a different name for the same predicate.
2024-06-02 12:07:58 +02:00
Amaan Qureshi
488e39a8f1 feat(query): adapt to upstream changes 2024-05-26 00:24:03 +02:00
Christian Clason
4d9fb7d8b0 ci: Nvim 0.10 macos artifact name 2024-05-17 08:57:04 +02:00
Bruno BELANYI
5c4892b055 fix(textproto): use 'pbtxt' filetype (#6427)
This is the actual name of the detected filetype.
2024-04-11 18:03:22 +02:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01:00
ObserverOfTime
8d3176cfbc fix(scripts): actually skip lockfile updates 2024-03-12 09:55:48 +02:00