-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
base: master
Are you sure you want to change the base?
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 |
This is done. There are some followup work to be done such as making wasmtime work on debug windows as well as making the importing of the library more robust, but I will punt these tasks to a future date. |
@@ -109,7 +109,14 @@ function M.add(lang, opts) | |||
path = paths[1] | |||
end | |||
|
|||
vim._ts_add_language(path, lang, symbol_name) | |||
if vim.endswith(path, '.wasm') then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be case-insensitive?
return data; | ||
} | ||
|
||
static const char *wasmerr_to_str(TSWasmErrorKind werr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this match the convention of the existing os_strerror
, uv_strerror
?
static const char *wasmerr_to_str(TSWasmErrorKind werr) | |
static const char *wasm_strerr(TSWasmErrorKind werr) |
b3c1cd3
to
1c74802
Compare
a3b394e
to
f857699
Compare
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
).