Commit graph

1107 commits

Author SHA1 Message Date
Max Brunsfeld
dedcc5255a
Ignore external tokens that are zero-length and extra (#4213)
Co-authored-by: Anthony <anthony@zed.dev>
2025-02-17 15:07:44 -08:00
Max Brunsfeld
14b8ead412
Fix crash when loading languages w/ old ABI via wasm (#4210) 2025-02-17 13:56:53 -08:00
Amaan Qureshi
a40265cbeb refactor(web): rename tree-sitter.js to web-tree-sitter.js
This is not breaking for consumers of the web bindings, nor the
playground as both filenames will be kept in the .github.io repo
2025-02-11 22:56:50 -05:00
Roberto Huertas
f95e0e3a56 fix(web): provide type in the exports
When using TypeScript projects using other module settings than CommonJs, the types were not correctly exposed, and the compilation failed.

This adds the types path to the exports so compilation works for `module: NodeNext` and other variants.
2025-02-08 12:47:17 -05:00
Thomas Klausner
14647b2a38 build: add a comment explaining why we undef _POSIX_C_SOURCE 2025-02-02 17:14:28 -05:00
Thomas Klausner
5311904619 build: fix compilation on NetBSD a different way 2025-02-02 17:14:28 -05:00
Amaan Qureshi
f5afe475de
build: bump version to 0.25.1 2025-02-02 02:07:36 -05:00
Amaan Qureshi
05d443a019
style(rust): correct doc comments 2025-02-02 02:07:36 -05:00
Riley Bruins
9ad096ef22 fix(lib): prevent finished_tree assertion failure
**Problem:** When resetting the parser during subtree balancing, an
error is thrown:

```
parser.c:2198: ts_parser_parse: Assertion `self->finished_tree.ptr' failed.
```

**Solution:** Reset `canceled_balancing` to false in
`ts_parser_reset()`.
2025-02-01 16:19:14 -05:00
Amaan Qureshi
a115e515ff feat(web): include C source files for debugging 2025-01-31 20:41:11 -05:00
Amaan Qureshi
060e69e671 build(web): relocate source files in WASM sourcemap 2025-01-31 20:41:11 -05:00
Amaan Qureshi
40dfe6bd51 build(web): bump deps 2025-01-31 20:41:11 -05:00
Amaan Qureshi
dc64bb5395 chore: adapt to latest clippy lints 2025-01-31 20:41:11 -05:00
Amaan Qureshi
304e56850f chore(web): update type definitions 2025-01-28 20:59:37 -05:00
Amaan Qureshi
9d62f17bc4 fix(web): correct doc comment 2025-01-28 20:59:37 -05:00
Amaan Qureshi
9515be4fc1 fix(web): update check-artifacts script 2025-01-26 14:39:01 -05:00
Amaan Qureshi
56a6df0c57 build: bump tree-sitter-language to 0.1.4 2025-01-26 14:15:01 -05:00
Amaan Qureshi
5546862bb7 fix(web): correct debug file location 2025-01-26 14:15:01 -05:00
Christian Clason
67cc0a9f58 build(deps): bump wasmtime-c-api to v29.0.1 2025-01-26 12:45:15 -05:00
Christian Clason
36f5f7918f fix(endian): rely on system headers where possible
Problem: Macros (re)defined in `endian.h` conflict with system headers
on FreeBSD (at least).

Solution: Rely on system `endian.h` on OpenBSD, FreeBSD, NetBSD, and
DragonFly

Ref. https://github.com/mikepb/endian.h/issues/4
2025-01-25 13:28:46 -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
dependabot[bot]
9003b883f1 build(deps-dev): bump vite from 6.0.7 to 6.0.11 in /lib/binding_web
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.0.7 to 6.0.11.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.11/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-25 00:18:35 -05:00
Amaan Qureshi
e1eb2fdbca refactor(web): break apart the logic for constructing a query 2025-01-23 00:43:27 -05:00
Amaan Qureshi
b5894fac95 feat(web): use custom error type for query errors 2025-01-23 00:43:27 -05:00
Amaan Qureshi
6c3eb760a9 feat: improve PredicateStep types 2025-01-23 00:43:27 -05:00
Amaan Qureshi
a76934dda0 test: update tests 2025-01-23 00:43:27 -05:00
Amaan Qureshi
a18ae03e0b docs(web): update type definitions 2025-01-23 00:43:27 -05:00
Amaan Qureshi
e901716ebd refactor(web)!: deprecate Language.query in favor of new Query 2025-01-23 00:43:27 -05:00
Amaan Qureshi
e874d2d8f8 feat: add a patternIndex field to QueryCapture
This lets users look up the predicates associated with a given
`QueryCapture`, by using the `patternIndex` field and calling
`predicatesForPattern`
2025-01-23 00:43:27 -05:00
Amaan Qureshi
d60c6f163d refactor(web)!: rename pattern to patternIndex in QueryMatch
This aligns with other bindings
2025-01-23 00:43:27 -05:00
Amaan Qureshi
e3ac504e86 refactor(web): move CaptureQuantifier definition 2025-01-23 00:43:27 -05:00
Amaan Qureshi
58662417a6 fix(web): only export public types
This avoids exporting extra unnecessary stuff in the final JS file
2025-01-23 00:43:27 -05:00
Yuri Astrakhan
3e7721e554 chore: a few more minor lints 2025-01-23 00:10:16 -05:00
Amaan Qureshi
79244b5815 fix(web): correct builds for CJS 2025-01-21 12:36:15 -05:00
Amaan Qureshi
f6a943a1ad docs(web): update README and add CONTRIBUTING docs 2025-01-21 12:36:15 -05:00
Amaan Qureshi
0dba35c30f docs(web): update docs 2025-01-21 12:36:15 -05:00
Amaan Qureshi
1f66d156b5 test: update tests 2025-01-21 12:36:15 -05:00
Amaan Qureshi
09cb4c5729 feat(web): document the API 2025-01-21 12:36:15 -05:00
Amaan Qureshi
a4b20c1c56 feat: publish both CJS and ESM files
This way, users can pick whichever one works for their needs
2025-01-21 12:36:15 -05:00
Amaan Qureshi
10e6ecf162 feat: begin autogenerating web-tree-sitter.d.ts 2025-01-21 12:36:15 -05:00
Amaan Qureshi
be7716dfa7 feat(web)!: use the WASM module in the bindings, and not the other way around
Parser is no longer the default export, but you *must* call
`Parser.init()` before doing anything still
2025-01-21 12:36:15 -05:00
Amaan Qureshi
25e6de4a0a docs(web): update process on fetching WASM fiels 2025-01-21 12:36:15 -05:00
Amaan Qureshi
169d7ad57f refactor: rewrite scripts in typescript 2025-01-21 12:36:15 -05:00
Amaan Qureshi
31ceb99603 feat: add and apply eslint config 2025-01-21 12:36:15 -05:00
Amaan Qureshi
2cae67892e feat(web)!: rewrite the library in TypeScript 2025-01-21 12:36:15 -05:00
Amaan Qureshi
07a86b1729 build(web): use files in package.json instead of .npmignore 2025-01-21 12:36:15 -05:00
Amaan Qureshi
6e88672dac chore: cleanup unused code 2025-01-21 01:17:03 -05:00
Amaan Qureshi
c8353a52af fix(lib): don't always clear the tree stack
Only do so if the parser is not resuming balancing
2025-01-21 00:31:34 -05:00
Amaan Qureshi
27bc78698d feat(lib): implement Send + Sync for WasmStore 2025-01-21 00:21:35 -05:00