Skip to content
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

Tree-sitter support via WASM #3230

Open
gdamore opened this issue Apr 4, 2024 · 0 comments
Open

Tree-sitter support via WASM #3230

gdamore opened this issue Apr 4, 2024 · 0 comments

Comments

@gdamore
Copy link

gdamore commented Apr 4, 2024

I know that there was another ticket about tree-sitter support -- but it looks like it got closed, probably because of cgo.

The good news is that with wasm and wazero, tree-sitter can be done entirely without cgo.

Basically, tree-sitter modules (not all, but most) can compile to wasm. Then you take that wasm file, and can use wazero to either compile it to native code (arm64 or amd64), or you can use it in interpreter mode to run it (will obviously be slower).

This may offer a nice cgo-free path. Note that the wasm stuff is used by zed.dev for their isolation of the tree-sitter into a separate space, preventing a bad tree-sitter grammar from taking down the process.

I am not a user of micro, although you're using my Tcell package, and I'm also the author of a couple of tree-sitter grammars (notably the D one) and I'm keen to help the ecosystem for D -- and thought this might help. Feel free to close if utterly non-interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant