Commit graph

352 commits

Author SHA1 Message Date
Will Lillis 791d7cead4 perf(cli): minor allocation and write call reductions
- Cache tree byte range length to avoid redundant FFI calls per test
- Combine 5 separate XML attribute write! calls into one
- Pre-allocate format_sexp output buffer to avoid repeated growth
2026-03-31 01:27:05 -04:00
Will Lillis cf8719f132 fix(rust): correct various typos 2026-03-28 05:23:10 -04:00
Will Lillis 1a82df3cac fix(rust): address new nightly lints 2026-03-28 05:23:10 -04:00
Will Lillis 08d676b417 fix(lib): document invariants that must be upheld for TSInputEdit 2026-03-22 23:17:01 -04:00
Amaan Qureshi b8fcf27661 build(rust): update deps 2026-02-18 00:59:34 -05:00
Amaan Qureshi 77c8f075f3 lib: fix clippy warnings from edition bump 2026-02-18 00:59:34 -05:00
Will Lillis 48e921883a fix(rust)!: return u32 from Node::child_count
This matches the type returned from the underlying C library, and also
composes more cleanly with other functions like `Node::child`
2026-02-09 21:05:48 -05:00
Bertie Wheen 39f407e3ff
fix(lib): correct ts_parser_parse docstring (#5295) 2026-02-04 00:49:54 -05:00
Sasha Koss ecb854da3b Add missing Wasm shims required by tree-sitter-ruby 2026-01-24 03:04:44 -05:00
DanikVitek b12009a746 fix: Clarify/fix lifetimes
- One has to think about lifetimes if a type has one:
  - `<&'a Node<'tree>>::language` now returns `LanguageRef<'tree>` instead of
    `LanguageRef<'a>`, as it should;
- Remove explicit "outlives" requirements from `QueryMatches`, `QueryCaptures`,
  and their impl blocks, because they're inferred
- Removed unnecessary `&mut` from `cst_render_node`'s `cursor` parameter
2026-01-17 00:14:21 -05:00
DanikVitek 9f9a0bc410 fix: Renamed TreeCursor<'cursor> into TreeCursor<'tree>,
to be consistant with the usages and reduse confusion
2026-01-17 00:14:21 -05:00
Will Lillis aefae11c0d fix(build): define _BSD_SOURCE
System endian conversion macros are gated behind this feature flag for
older versions of GLIBC. `_BSD_SOURCE` and `_SVID_SOURCE` were
deprecated and replaced with `_DEFAULT_SOURCE` starting with GLIBC 2.19.
2026-01-12 19:41:58 -05:00
Piotr Osiewicz c0b1710f8a Add containing range APIs to query cursor
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: John Tur <john-tur@outlook.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-12-03 18:06:16 -05:00
Will Lillis e344837e35 fix(rust): minor cleanup in generate code 2025-10-24 17:50:28 -04:00
Riley Bruins 8c22426223
feat(rust): add new_raw to create a raw, unchecked query pointer 2025-09-23 19:06:22 -04:00
Amaan Qureshi b0cdab85fe refactor(rust): avoid panics where possible 2025-09-23 01:19:14 -04:00
Amaan Qureshi 95ab17e444 build: define _DARWIN_C_SOURCE 2025-09-22 19:50:43 +03:00
Max Brunsfeld 9b914885f1
Fix issues preventing releases from successfully publishing (#4867)
* Correct the path to the CLI npm package in release job

* Specify a version for tree-sitter-language

* Fix path to README in doc include
2025-09-22 09:24:30 -07:00
WillLillis 92678f0fc5 fix(rust): pass correct fd to C lib's ts_tree_print_dot_graph
Co-authored-by: Amaan Qureshi <git@amaanq.com>
2025-09-21 18:21:57 -04:00
Amaan Qureshi 0cf217179c feat(rust): add reborrow method to ParseOptions 2025-09-19 17:40:35 -04:00
Amaan Qureshi a69367f739 feat: add API for editing points and ranges 2025-09-19 17:40:26 -04:00
Amaan Qureshi 22553b3372 feat: support compiling to wasm32-unknown-unknown 2025-09-17 04:57:49 -04:00
Amaan Qureshi d60ef9ad0a feat(rust)!: remove deprecated functions 2025-09-12 02:50:30 -04:00
Daniel Müller 937dcf5fd1 feat(rust)!: use ops::ControlFlow as parse and query progress return value
Instead of returning an undocumented boolean flag, use a
core::ops::ControlFlow object. At the expense of being a bit more
verbose, this is a type that should be self-explanatory in the context
of a callback, as an indication of whether to continue processing or
stop.
2025-09-11 01:59:21 -04:00
Amaan Qureshi cd12e66e67 fix(lib): don't run code snippet as a doctest 2025-09-04 04:22:32 -04:00
Amaan Qureshi 1d0ebd1065 fix(rust): do not interpret readme doc comments as doc tests 2025-09-04 04:22:32 -04:00
ObserverOfTime b75196bb81 feat(c): rename DecodeFunction to TSDecodeFunction
Keep a typedef for backwards compatibility until ABI 16.
2025-09-01 03:17:44 -04:00
Quentin LE DILAVREC 79177a1cd5
fix(rust): EqCapture accepted cases where number of captured nodes differed by one
Problem: When using alternations, the `#eq?` predicate does not always use the same capture name.

Solution: Iterate the left and right captured nodes more independently.
2025-08-27 10:25:29 +02:00
ObserverOfTime 88e0b4cea4 docs: change WASM/wasm to Wasm
That is the official capitalisation.
2025-08-21 09:56:32 +03:00
Will Lillis 5e1daf0c41 fix(rust)!: take u32 for index parameter to Node::{child, named_child}
Co-authored-by: Ye Sijun <junnplus@gmail.com>
2025-08-03 12:58:53 -04:00
Will Lillis d3c2fed4b3 fix(rust): correct indices for Node::utf16_text 2025-08-02 16:03:55 -04:00
Riley Bruins dff828cdbe fix(rust): prevent overflow in error message calculation
**Problem:** When encountering an invalid symbol at the beginning of the
file, the rust bindings attempt to index the character at position -1 of
the query source, which leads to an overflow and thus invalid character
index which causes a panic.

**Solution:** Bounds check the offset before performing the subtraction.
2025-07-22 09:51:28 +02:00
Will Lillis 86b2c939c7 fix(rust): address nightly clippy lint useless_if_let_seq 2025-07-20 21:14:47 -04:00
Will Lillis be8b3e282a fix(rust): remove unused Command import 2025-06-26 00:54:44 -04:00
James McCoy 889015f03b
build(rust): use $CARGO_PKG_RUST_VERSION when generating bindings (#4512)
Since cargo 1.63, $CARGO_PKG_RUST_VERSION is set in the build
environment to the value of the rust-version Cargo.toml field.

This removes the need to manually invoke cargo from build.rs during a
build of the tree-sitter crate with the bindgen feature enabled.

Removing the cargo invocation also ensures the build doesn't write to
the current directory when the target directory has been redirected
elsewhere. "cargo metadata" will attempt to update Cargo.lock, which
will fail if the source tree is read-only.
2025-06-13 11:11:22 -07:00
Amaan Qureshi 0191e94226 docs(rust): remove adding cc as a build dependency for consumers 2025-04-28 18:30:45 -04:00
Will Lillis 9fdf685dd5 fix(bindings): report wasm store error in rust bindings set_language 2025-04-14 22:15:40 -04:00
Jason Boatman abc5c6bc50
Fix WASI build by not calling a non-existent function. (#4343) 2025-04-08 09:33:48 -07:00
Simon Willshire ee8d529552
fix(rust): use core crates for no_std
also add `no_std` build to CI
2025-03-25 14:30:32 +01:00
WillLillis dac6300558 fix(rust): address new clippy lint for pointer comparisons 2025-03-25 13:44:42 +01:00
Riley Bruins cc3994928c feat(lib): quote invalid nodes, fields, and captures 2025-03-12 10:28:57 +01:00
June Gschwantner 0b28226615
docs(bindings): Add "Using WASM Grammar files" section to binding_rust (#4235)
Some checks failed
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 12s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
Check WASM Exports / check-wasm-exports (push) Has been cancelled
2025-03-06 14:15:21 -08:00
WillLillis 11071ed682 fix(rust): adapt to new nightly lint
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
2025-03-06 09:32:21 +01:00
Amaan Qureshi 05d443a019
style(rust): correct doc comments 2025-02-02 02:07:36 -05:00
Amaan Qureshi dc64bb5395 chore: adapt to latest clippy lints 2025-01-31 20:41:11 -05:00
Allan Clements cda634a1c4 feat: add error information in the progress callback
This allows users to bail parsing if an error was *definitely* detected
using the progress callback, as all possible stack versions have a
non-zero error cost.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2025-01-25 02:47:39 -05:00
Amaan Qureshi 8bb1448a6f feat: add the semantic version to TSLanguage, and expose an API for retrieving it 2025-01-25 01:14:30 -05:00
Yuri Astrakhan 3e7721e554 chore: a few more minor lints 2025-01-23 00:10:16 -05:00
Amaan Qureshi 27bc78698d feat(lib): implement Send + Sync for WasmStore 2025-01-21 00:21:35 -05:00
Amaan Qureshi 29e6717c31 fix(lib): temporarily allow lint with false positives
Some checks failed
CI / sanitize (push) Failing after 15s
CI / build (push) Failing after 16s
CI / checks (push) Has been cancelled
2025-01-17 20:41:06 -05:00