Files
vscode-extension-samples/wasm-component-model-resource/README.md
Dirk Bäumer 209ce0e81b Add wasm based examples (#1018)
* WIP

* Add custom add request

* Update package.json

* Component model resource example

* Update to latest wit-bindgen

* WIP

* Minor example updates

* Update wasm-lsp example

* Added some minor comments

* Minor renames

* Change lsp server to count files

* More model resource work

* WIP

* Make the example work

* Update examples to latest

* Update sample to latest tooling

* Update sample to latest wit2ts tooling

* WIP

* Carry over https://github.com/microsoft/vscode-docs/pull/7234/files

* Code cleanup

* Remove dist folder

* Remove another dist folder
2024-05-07 16:12:01 +02:00

27 lines
1.5 KiB
Markdown

# WASM Component Model Example
An example demonstrating how to use the component model to integrate WebAssembly code into VS Code.
## Functionality
A simple calculator that can perform add, sub, mul and div. The calculator is implemented in Rust and compiled to WebAssembly code and then call from JavaScript.
## Pre-requisites
To run the sample the following tool chains need to be installed
- [Rust](https://www.rust-lang.org/): installation instructions can be found [here](https://www.rust-lang.org/tools/install)
- [wasm-tools](https://github.com/bytecodealliance/wasm-tools): releases can be found [here](https://github.com/bytecodealliance/wasm-tools/releases). You need at least version >= 1.200 to run the example.
## Running the Sample in the Desktop
- Run `npm install` in this folder. This installs all necessary npm modules.
- Open VS Code on this folder.
- Execute the launch config `Run Example`.
## Running the Sample in the Web
As a pre-requisite follow the instructions [here](https://code.visualstudio.com/api/extension-guides/web-extensions#test-your-web-extension-in-vscode.dev) to generate necessary certificate to side load the extension into vscode.dev or insiders.vscode.dev.
Then compile the extension for the Web by running `npm run esbuild`, start a local extension server using `npm run serve`, open vscode.dev or insiders.vscode.dev in a browser and execute the command `Install Extension from Location`. As a location use `https://localhost:5000`.