How we built a VS Code extension with Rust, WebAssembly, and TypeScript

Click for: original source

We’ll talk through our design decisions in building the extension, and along the way we’ll touch on the Language Server Protocol and, more generally, how an IDE extension works. By osohq.com.

The article dives straight in:

  • Why we chose VS Code
  • Using the Language Server Protocol (LSP)
  • Design
  • Why we chose WebAssembly
  • Deciding against a Rust LSP Library
  • Implementation

With our sights set on Wasm, implementing the language server in Rust largely went off without a hitch, and we landed on a clean, three-part design consisting of a TypeScript entrypoint module, a second, tiny TypeScript module that delegates connection handling to Microsoft’s vscode-languageserver package, and the polar-language-server crate compiled to Wasm.

By splitting the language server into a thin TypeScript wrapper and a Rust core, we were able to build on top of some nice LSP scaffolding that exists in the JavaScript ecosystem while still implementing all of the new diagnostic-wrangling logic in Rust. Nice one!

[Read More]

Tags app-development open-source programming code-refactoring software performance