Commit graph

1361 commits

Author SHA1 Message Date
Amaan Qureshi
1f0feb5254 feat: add shell completions 2024-09-24 12:46:38 -04:00
Amaan Qureshi
d3c262a104 fix(test): correctly handle assertions on empty lines
Also fixes assertions for captures spanning on multiple lines.

Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
2024-09-24 12:36:33 -04:00
Amaan Qureshi
cc4378e751 feat(test): test all queries
Fallback to default testing for all queries present in the parser's
queries directory.

For a given query <QUERY>.scm, the test files are searched in
test/<QUERY>/*

Also mimic the output of other test-running subcommands when testing
queries.

Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
2024-09-24 12:36:33 -04:00
Amaan Qureshi
52f696096d feat: provide a rebuild flag to force rebuild parsers 2024-09-24 11:27:59 -04:00
Samuel Tardieu
1aa28e04ee style(tests): do not use .as_bytes().len() on strings 2024-09-22 20:27:38 -04:00
Amaan Qureshi
83d41542f8 feat: add eslint configuration package 2024-09-22 20:26:04 -04:00
Will Lillis
99dbbbcbe9
fix(fuzz): skip tests marked with :skip & don't report errors on tests marked with :error 2024-09-22 03:46:52 -04:00
Amaan Qureshi
4934a16173 feat: add root field in node-types.json 2024-09-22 01:48:03 -04:00
Amaan Qureshi
6f050f0da5 fix: properly handle utf8 code points for highlight and tag assertions 2024-09-22 01:03:59 -04:00
Joel Spadin
755e49e212 fix(wasm): use / paths for workdir
Reimplemented the fix from #2183 to fix building WASM files with Docker
on Windows again. The --workdir argument gives a path inside the Docker
container, so it must use forward slashes regardless of the default path
separator on the host OS.
2024-09-22 00:50:33 -04:00
Amaan Qureshi
0a85744eba fix(lib): peek at the next sibling when iterating to find the child that contains a given descendant
This issue shows up when we have a zero-width token that is the target
descendant node, previously the previous sibling would be returned as
the child that contains the descendant, which is incorrect.
2024-09-17 04:37:43 +02:00
ObserverOfTime
6e19fccf39 chore(bindings): update rust lib docs 2024-09-17 03:40:48 +02:00
Dave Abrahams
112acd5b93
fix(generate): remove excludes in Package.swift 2024-09-16 21:40:21 -04:00
Hanlu
ff813a311b
fix: correct comment quote 2024-09-16 21:39:49 -04:00
Will Lillis
b0e8e50a19
fix(cli): remove duplicate short options from fuzz command (#3635)
- Remove short option from fuzz command edits option
- Remove short option from fuzz command iterations option
2024-09-15 11:04:12 +03:00
Amaan Qureshi
7e3f572655 feat: add field_name_for_named_child 2024-09-09 11:05:29 -04:00
Amaan Qureshi
d8ab779df4 fix(generate): do not generate large character sets for unused variables 2024-09-08 15:42:18 -04:00
Amaan Qureshi
cbd3bb5b9a feat!: remove the build-wasm subcommand
`build --wasm` should be used instead
2024-09-08 13:41:26 -04:00
Amaan Qureshi
10e474f488 feat!: remove filter flag from commands in favor of include and exclude 2024-09-07 20:53:04 -04:00
Amaan Qureshi
5e46fef0d7 chore: clippy lints 2024-09-07 20:31:20 -04:00
Amaan Qureshi
9301d38b77 feat!: remove C++ support for external scanners 2024-09-07 20:14:36 -04:00
Jinser Kafka
fd190f1d9d fix(cli): keep skipped tests unchanged in the test/corpus 2024-09-07 18:55:49 -04:00
Amaan Qureshi
4d3d1f0df2 fix(generate): add tree-sitter to the dev-dependencies of the Cargo.toml 2024-09-07 17:46:09 -04:00
Amaan Qureshi
272ebf77b9 fix(test): retain attributes when running test -u 2024-09-01 06:18:55 -04:00
Amaan Qureshi
0a486d508f fix(test): exit with an error if a test marked with :error has no error 2024-09-01 06:18:55 -04:00
Amaan Qureshi
ee06325f67 fix(lib): correct extra node creation from non-zero root-alias cursors 2024-08-31 23:58:19 -04:00
Amaan Qureshi
53cc93c267 fix(generate): disallow inline variables referencing themselves
This fixes an infinite loop bug
2024-08-31 16:57:23 -04:00
Amaan Qureshi
3f424c0121 feat: add an API to time out query executions
Currently, if a predicate is hard to match on the Rust side, a sizable
query against a very large file can take forever, and ends up hanging.
This commit adds an API function `ts_query_cursor_set_timeout_micros` to
limit how long query execution is allowed to take, thereby negating the
chance of a hang to occur.
2024-08-31 14:33:28 -04:00
Amaan Qureshi
d0125ef387 feat(bindings): bump go-tree-sitter version 2024-08-29 22:50:27 -04:00
Amaan Qureshi
278526ef75 fix(cli): remove conflicting short flags in the fuzz subcommand 2024-08-29 22:07:41 -04:00
Amaan Qureshi
b5a91a4a85 feat(generate): bump tree-sitter dev dependency to 0.23 2024-08-29 22:07:33 -04:00
Amaan Qureshi
253a112dd4 fix(generate): remove necessary files from gitignore template 2024-08-29 21:50:20 -04:00
Amaan Qureshi
12fb31826b
0.23.0 2024-08-26 09:07:00 -04:00
Amaan Qureshi
fc4d7bd995 fix(cli): dedup preceding_auxiliary_symbols 2024-08-26 09:03:08 -04:00
ObserverOfTime
ff8b50caa6 build(bindings): use language version in soname 2024-08-25 15:03:13 -04:00
Amaan Qureshi
6ef76858c0 fix!: revert interning of a sequence or choice of a single rule
This reverts commit 252e2a4bc0
2024-08-24 19:43:04 -04:00
Amaan Qureshi
973b01071e fix(go): update parser name in binding files, add to docs 2024-08-24 19:24:06 -04:00
Amaan Qureshi
2150c91114 fix(bindings): update go bindings 2024-08-23 23:51:04 -04:00
Ryan Patterson
b5e4ef6d9a
clone wasm store engine (#3542)
This resolves https://github.com/tree-sitter/tree-sitter/issues/3454.

This brings the usage of wasmtime::Engine in line with how wasmtime
intends it to be used. All wasmtime functions that receive an Engine
always receive an `&Engine`, never an owned `Engine`.  They are always
responsible for cloning the reference if they need it.

This brings the usage of wasmtime::Engine in line with how TSParser
treats TSLanguages: when setting a language to the parser, the parser is
responsible for cloning the reference to the TSLanguage. It is
counterintuitive for TSParser to have different behavior when receiving
wasmtime_engine_t.

C API users also expect this behavior, see "Memory Management"
[here](https://docs.wasmtime.dev/c-api/wasm_8h.html). Talking about the
C API: without this change, failing to clone the `wasmtime_engine_t`
(which, again, is never something API users need to do in wasmtime) and
then reusing the engine in multiple TSLanguages results in a use after
free. With this change, failing to call `wasm_engine_delete` on your
owned Engine results in a memory leak. Memory leaks are safer than
use-after-free.
2024-08-22 08:01:37 -07:00
ObserverOfTime
f459c3d872 feat(bindings)!: use capsules in python 2024-08-20 12:33:11 +03:00
Amaan Qureshi
6dd459b4ab fix(lib): an empty root node should not precede an empty range
The problem is, given an empty file, the root node of this file spans 0
bytes. As such, the logic for determining whether or not the node
precedes the range fails, and is true when it should be false.
2024-08-17 17:05:26 -04:00
Ron Panduwana
2bb20fe2fe
feat: allow external scanners to use the logger
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-08-17 14:46:28 -04:00
Amaan Qureshi
fec6c77da8 fix(generate): rename cargo.toml template
This fixes issues with vendoring on case-insensitive file systems
2024-08-17 01:39:52 -04:00
ObserverOfTime
2eeeed0f2a fix(make): fail properly on Windows 2024-08-17 00:51:27 -04:00
buckynbrocko
7583d394b4
feat(cli): add --show-fields flag to test command (#3502) 2024-08-03 21:54:18 +03:00
Ryan Patterson
779566f588
Reset language when resetting wasm store (#3495)
* Reset language when resetting wasm store

* test behavior of language copying
2024-07-31 10:30:58 -07:00
ObserverOfTime
ce37b112dc build(wasm): bump emscripten to 3.1.64 2024-07-29 15:59:56 +03:00
Guillaume Bertholon
1c7b518b9d
build(loader): make dependencies optional (#1638)
The `tree-sitter-loader` crate currently always pulls
`tree-sitter-highlight` and `tree-sitter-tags` as dependencies.
However, apart from the tree-sitter CLI, most clients will not need both
of these libraries.

This commit makes the dependencies optional, but still includes them by
default in order not to break the backward compatibility.
2024-07-28 10:59:21 +03:00
ObserverOfTime
3950dddfde fix(rust): fix new clippy warnings 2024-07-28 10:12:32 +03:00
Amaan Qureshi
25c7189180 feat(lib): add ts_query_end_byte_for_pattern 2024-07-07 20:29:09 -04:00