Home ยป WebAssembly Empowered VS Code: Transmute libraries in foreign tongues into usable extensions

WebAssembly Empowered VS Code: Transmute libraries in foreign tongues into usable extensions

The VS Code Extension system is primarily written in TypeScript/JavaScript, but recently Microsoft has started supporting WebAssembly (WASM) to run binaries compiled from other languages like C/C++ or Rust. An example of this is the Visual Studio Code for Education, which embeds the Python interpreter binary (CPython, written in C and then converted to WASM) to process Python code on the web.

The WebAssembly format supported by VS Code is the WebAssembly System Interface (WASI) from the ByteCode Alliance group, of which Microsoft is a founding member. The latest version of WASI 0.2 supports the Component Model, allowing WASM to have multiple components and communicate with each other through the WIT (WASM Interface Type) interface. This results in extensions built with WASM becoming even more complex, enabling the use of libraries from various languages.

An example showcased by Microsoft is the transformation of Rust libraries into WASM and then using them in the VS Code extension written in Rust. These two components communicate through wit-bindgen, a tool created by Microsoft to aid in binding. In the future, Microsoft states that they will be able to develop language servers or program language engines using WebAssembly.

Source: VS Code Blog

TLDR: VS Code Extension system now supports WebAssembly, allowing for the utilization of binaries from languages like C/C++ or Rust. This is made possible through the WASI format, enhancing the complexity and functionality of extensions built with WASM. Microsoft showcases examples of integrating Rust libraries into VS Code extensions using WebAssembly with plans for further advancements in the future.

More Reading

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Unlock the Potential of Diablo 1: Play Through Your Web Browser Using File Conversion to WebAssembly

Enhanced Python Support in Cloudflare Workers with FastAPI and Langchain Integration

Transitioning from Skew to TypeScript: Figma’s Paradigm Shift