Skip to content

Latest commit

 

History

History
91 lines (53 loc) · 2.53 KB

CONTRIBUTING.md

File metadata and controls

91 lines (53 loc) · 2.53 KB

Welcome!

This project hopes to be simple to contribute to. It's written in Rust and Typescript, and uses Bun to manage the VsCode build process.

Dev Setup

Install Dependencies

Please install the following dependencies:

  • Pre-reqs:
Dependency Version
Node >20
Bun > 1.0.0
Rust + Cargo Edition 2021
wasm-pack > 0.10.0

rustup is recommended - https://rustup.rs/


  • after installing the above, please run the following:
bun install
  • install wasm-pack:
cargo install wasm-pack

Notes on Bun

Why both package-lock and bun.lockb? The @vscode/vsce package uses npm under the hood to list dependencies. It's important that we keep both package-lock and bun.lock in sync.

VsCode - How it works (for now)

The main entry point of the project is of course the package.json. The package.json contains a scripts section that defines the build process.

To run the build process, simply run:

bun run build

To run the build process in watch mode, simply run:

bun run watch

Both of these scripts run build.ts, which executes wasm-pack on any .rs change, and esbuild on any .ts change.

We're using esbuild for bundling until Bun can completely support CJS, which is required by VsCode's internal LSP Node servers.

After running build.ts, the out files are copied to the server/src/rust dir and also server/out directories. This is so that the TS can pick up the types generated by wasm-pack and the WebAssembly module can be loaded by the LSP server after vsce packages the extension.

VsCode - Debugging

After you run the watch mode in a terminal, you can press F5 to start debugging the extension. This will open a new VsCode window with the extension running in debug mode.

Rust - How it works (for now)

There are two crates in this project:

  • does-it-throw
  • does-it-throw-wasm

The does-it-throw crate is a library crate that contains the core logic of the extension. It's a library crate because it can be used across other LSPs and the WebAssembly module.

To run integration tests on the library crate, simply run the following at the project root:

cargo test

does-it-throw-wasm is a binary crate that contains the WebAssembly module. It's a binary crate because it's compiled to WebAssembly. It depends on the does-it-throw crate.

To run unit tests on the WebAssembly module, simply run the following at the project root:

cargo test