Commit graph

6030 commits

Author SHA1 Message Date
Christian Clason
be7272c2d8 feat!: update tier 1 parsers to versions 2025-05-04 19:55:04 +02:00
Christian Clason
03b2f7839e feat(locals)!: remove locals module
Problem: `locals.lua` was neither used nor tested, and providing it goes
against the goal of nvim-treesitter not being a required dependency for
other plugins.

Solution: Remove the module and document that the queries are provided
as-is for limited backward compatibility only.
2025-05-04 16:59:44 +02:00
Christian Clason
c22ad502ca 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-04 11:47:20 +02:00
Riley Bruins
7534cd8846 refactor(locals): fix type annotations and warnings 2025-05-04 10:38:35 +02:00
Christian Clason
27c36771fc tests(angular): don' reset filetype
`htmlangular` filetype support is now included in Nvim, so don't set
the filetype.
2025-05-04 10:38:35 +02:00
Christian Clason
a8043d4a60 tests(gleam): fix assert tests that no longer parse correctly 2025-05-04 10:38:35 +02:00
Christian Clason
2428b96081 feat(vim): update parser and queries
* add support for `:substitute` command
* add support for `=` lua chunks
2025-05-02 17:19:08 +02:00
Christian Clason
b21f320624 feat(gdscript)!: update parser and queries
`(underscore)` node was removed
2025-05-02 17:15:46 +02:00
Christian Clason
1fb96973df feat(parsers): update robot, earthfile, racket, javadoc, scheme, t32, tact, templ, kotlin, tcl, meson, mlir 2025-05-02 17:10:35 +02:00
Christian Clason
046317ec2d fix(indent): don't skip parsing for yaml 2025-05-01 19:11:30 +02:00
Christian Clason
17a8ac4863 chore: remove lockfile and update script
`main` branch and `parsers.lua` is the record of truth now
2025-05-01 17:30:57 +02:00
Christian Clason
9df9b89354 refactor(lua): fix some luals warnings 2025-05-01 17:30:57 +02:00
Christian Clason
4ae33973f3 feat(install)!: always generate from json if possible 2025-04-30 11:48:30 +02:00
Christian Clason
a9fbd07bf2 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-04-30 11:48:30 +02:00
Christian Clason
7919271e2d feat(parsers): update swift, tact, tcl, templ, mlir, kotlin, koto, elixir, php_only, ocaml, ocaml_interface, php, astro, slang, slim, blade, gleam, v, ledger 2025-04-30 11:48:30 +02:00
Christian Clason
fc193451ee feat: add .tsqueryrc.json 2025-04-30 11:48:30 +02:00
Christian Clason
d8000d2e5e feat(parsers): update ziggy, ziggy_schema, bibtex, latex 2025-04-30 11:48:30 +02:00
Christian Clason
06a62043c2 feat(tcl)!: update parser and queries 2025-04-30 11:48:30 +02:00
Christian Clason
47e4f82a68 feat(julia)!: update parser and queries 2025-04-30 11:48:30 +02:00
Christian Clason
5d07c93750 feat(parsers): update nickel, sql, devicetree, dhall, htmldjango, t32, gap, javadoc, templ, jinja, tera, verilog, meson, mlir, typespec, wit, phpdoc, superhtml, git_config, swift, terraform, vim, koto, rasi, rescript, bp, enforce, erlang, jinja_inline, cmake, fennel, comment, slint, elm, rust, hcl 2025-04-30 11:48:30 +02:00
Christian Clason
086c400917 feat(html): use gsub for mimetype lookup 2025-04-30 11:48:30 +02:00
Christian Clason
f3e4b6d820 fix(install): skip tier 4 parsers when installing and updating 2025-04-30 11:48:30 +02:00
Christian Clason
c0f7dff590 fix(install): don't prompt on installed parsers (skip)
Use `:TSInstall!` or `force = true` to reinstall.
2025-04-30 11:48:30 +02:00
Christian Clason
1de4e3fee1 fix(formatter): increase match limit
Problem: Some very long patterns were not formatted correctly.

Solution: Increase the match limit when iterating to 1024.
2025-04-30 11:48:30 +02:00
przepompownia
d402cb9818 feat(install): allow pass callback to update()
Problem: cannot run `:TSUpdate synchronously`

Solution: pass callback used after exiting jobs
(like in `install-parsers`).
2025-04-30 11:48:30 +02:00
Sebastian Lyng Johansen
4eb1923759 fix(install): early return if parser_info does not exist 2025-04-30 11:48:30 +02:00
Christian Clason
3be8b2a31f 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-04-30 11:48:30 +02:00
Christian Clason
86a7cdde19 fix(ci): update to changed neovim release name 2025-04-30 11:48:30 +02:00
Christian Clason
0767b79904 fix(install): return error code in callback 2025-04-30 11:48:30 +02:00
Christian Clason
6fed522113 feat(install)!: bump minimum tree-sitter version to 0.24 2025-04-30 11:48:30 +02:00
Christian Clason
3f54b58fed ci(tests): add optional workflow for generating grammars
run on PR by adding label `ci:generate` or manually
2025-04-30 11:48:30 +02:00
Christian Clason
9941ad2afb feat(install): allow specifying max jobs 2025-04-30 11:48:30 +02:00
Christian Clason
4883846099 feat(config)!: remove auto_install
use https://github.com/lewis6991/ts-install.nvim instead
2025-04-30 11:48:30 +02:00
Christian Clason
6a143e48a4 feat(install)!: drop support for git
Problem: Using git for installing parsers can lead to data loss if in a
git commit buffer.

Solution: Only support downloading via curl+tar, which are installed on
all supported platforms (since Windows 10). Curl will also be required
for WASM parsers (and for `vim.net.download()`).
2025-04-30 11:48:30 +02:00
Christian Clason
3632923e78 feat!: use tree-sitter build 2025-04-30 11:48:30 +02:00
Christian Clason
7fea2eefd7 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-04-30 11:48:30 +02:00
Christian Clason
77757ac7d6 fix: vim.tbl_flatten is deprecated 2025-04-30 11:48:30 +02:00
Christian Clason
0db2935a1f 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-04-30 11:48:30 +02:00
nvim-treesitter-bot[bot]
19f84f36ea bot(readme): update 2025-04-30 11:48:30 +02:00
Christian Clason
82ca00ed97 feat(install)!: add explicit path field to parser info (#6476)
Problem: Using `url` for both remote repo and local path complicates the
code.

Solution: Add `path` field that overrides `url` and bypasses
git-specific manipulations, i.e., the contents of the `path` are used
as-is (no git repo needed).

This means `:TSUpdate` will skip such parsers; use `:TSInstall!` instead
after making local changes.

---------

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2025-04-30 11:48:30 +02:00
Lewis Russell
4c3e77db67 fix: do not use vim.iter (#6469) 2025-04-30 11:48:30 +02:00
Lewis Russell
5e1554ceda feat: improve logging of failed installs 2025-04-30 11:48:30 +02:00
Christian Clason
02aed5b54e feat(install)!: remove support for C++ scanners 2025-04-30 11:48:30 +02:00
Phạm Huy Hoàng
bfa8ff42d8 doc: better clarification of highlights/injections 2025-04-30 11:48:30 +02:00
Phạm Huy Hoàng
33467b292e fix(format): update scripts to support nightly (#6126)
No need for assert as the use is contained within the script only
2025-04-30 11:48:30 +02:00
Gregory Anders
c26917c9ac fix: update add_predicate and add_directive calls for upstream (#6106)
Update custom predicates and directives to handle multiple nodes per
capture ID per changes upstream.
2025-04-30 11:48:30 +02:00
Christian Clason
790ce166d7 fix: better output for update-lockfile 2025-04-30 11:48:30 +02:00
Christian Clason
ba0378c6c4 feat: improve check-queries 2025-04-30 11:48:30 +02:00
Christian Clason
e3afbce7ce docs: update CONTRIBUTING.md 2025-04-30 11:48:30 +02:00
Lewis Russell
4d1045072f refactor: pull out predicate function 2025-04-30 11:48:30 +02:00