Configuring Visual Studio Code with WebAssembly SDK

This guide will help you configure Visual Studio Code (VSCode) to use the Swift SDK for WebAssembly.

Note: This guide assumes you have already installed the Swift SDK for WebAssembly from the development snapshot release.

Prerequisites

Configure your SwiftPM package

  1. Open your Swift package in VSCode.
  2. Create a .vscode/settings.json with the following content:
{
    "swift.path": "<path-to-swift-toolchain-from-swift.org>/usr/bin",
}

Note: Replace <path-to-swift-toolchain-from-swift.org> with the path to the development snapshot Swift toolchain you downloaded from swift.org/install.

  1. Create a .sourcekit-lsp/config.json with the following content:
{
    "swiftPM": {
        "swiftSDK": "<Swift SDK id>"
    }
}

Note: Replace <Swift SDK id> with the Swift SDK id you installed using the swift sdk install command. You can find the installed SDK id by running swift sdk list.

  1. Reload the VSCode window by pressing Cmd + Shift + P and selecting Reload Window.

That's it! You can now build and auto-complete your Swift package using the Swift SDK for WebAssembly.