-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(treesitter): add support for wasm parsers #28415
Conversation
7264715
to
be7cc1c
Compare
c2519a9
to
31f9b03
Compare
7b627ac
to
ca9e93d
Compare
9f77fb6
to
2ecad21
Compare
Is this something we want to add to |
cbfa704
to
5ccf96b
Compare
Note: Investigate how wasm parsers and native parsers for the same language interact (i.e., trying to (un)load a wasm parser after loading a native or vice versa). |
2d414a3
to
3c30933
Compare
Note 2: Look at using sccache instead of EDIT Seems to make a noticeable difference: cold build from
Tested with
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
6c00a4c
to
8799870
Compare
Problem: Installing treesitter parser is hard (harder than climbing to heaven). Solution: Add optional support for wasm parsers with `wasmtime`. Notes: * Needs to be enabled by setting `ENABLE_WASMTIME` for tree-sitter and Neovim. Build with `make CMAKE_EXTRA_FLAGS=-DENABLE_WASMTIME=ON DEPS_CMAKE_FLAGS=-DENABLE_WASMTIME=ON` * Adds optional Rust (obviously) and C11 dependencies. * Wasmtime comes with a lot of features that can negatively affect Neovim performance due to library and symbol table size. Make sure to build with minimal features and full LTO. * To reduce re-compilation times, install `sccache` and build with `RUSTC_WRAPPER=<path/to/sccache> make ...`
Does that mean it's possible to actually unload parsers now? I thought that wasn't really supported yet.
see #22313 |
Problem
Treesitter parsers are currently distributed as compiled shared objects which need to be compiled by the users (with the help of nvim-treesitter).
Solution
Allow loading wasm built parsers.
Notes:
ENABLE_WASMTIME
) which will be dynamically linked.make CMAKE_EXTRA_FLAGS=-DENABLE_WASMTIME=ON DEPS_CMAKE_FLAGS=-DENABLE_WASMTIME=ON
TREE_SITTER_FEATURE_WASM
and also requireswasmtime
at build time. So no[uv_]dlopen
😢wasmtime
has includes that require C11 (static_assert
).sccache
and build withRUSTC_WRAPPER=sccache make ...
.Status
Waiting for the next tree-sitter release with the commit we're pulling in here to allow us to build against a wasmtime release with the build changes required to avoid unacceptable regressions on macOS. (Ideally, that release would also be built against the same version we use, but that is blocked by the same build system changes; luckily so far the versions have not become incompatible for our purpose.)