Company
Date Published
Author
Max Brunsfeld
Word count
1748
Language
English
Hacker News points
None

Summary

About two months ago, a project to make the Zed code editor extensible was initiated, with a focus on supporting multiple programming languages through extensible language support. The first milestone has been achieved by enabling syntax-based analysis using Tree-sitter, which requires specific grammars and queries for each language, and the integration of WebAssembly (wasm) to safely distribute and run Tree-sitter parsers across platforms. This hybrid system combines native and wasm components to efficiently handle data exchanges during parsing without relying on a user's C compiler, minimizing crashes and enhancing performance. The introduction of a WasmStore type within the Tree-sitter API allows for the creation of language instances from wasm binaries, maintaining safety and performance, while minimizing memory leaks through a custom memory allocation strategy during parsing. Since the release of this feature, the Zed community has developed 67 language extensions, showcasing the system's flexibility and the support for syntax-aware features. Future posts will discuss further uses of wasm in Zed's extensibility, inviting users to explore and contribute to its growing capabilities.