Skip to content

Commit 3e73346

Browse files
Add VSCode guide
1 parent 5eae9b2 commit 3e73346

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [JavaScript interoperation](getting-started/javascript-interop.md)
1212
- [Concurrency](getting-started/concurrency.md)
1313
- [Testing your app](getting-started/testing.md)
14+
- [Visual Studio Code](./getting-started/vscode.md)
1415
- [Debugging](getting-started/debugging.md)
1516
- [Troubleshooting](getting-started/troubleshooting.md)
1617
- [Examples](examples/index.md)

src/getting-started/setup-snapshot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installation - Development Snapshot
22

3-
## WebAssembly SDK - Cross compile to WebAssembly
3+
## Swift SDK for WebAssembly - Cross compile to WebAssembly
44

55
The upstream Open Source Swift toolchain does support WebAssembly as a target platform since **Swift 6.0**.
66
For those versions, you just need to install [Swift SDK for cross-compilation](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md).
320 KB
Loading

src/getting-started/vscode.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Configuring Visual Studio Code with WebAssembly SDK
2+
3+
This guide will help you configure Visual Studio Code (VSCode) to use the Swift SDK for WebAssembly.
4+
5+
> **Note**: This guide assumes you have already installed the [Swift SDK for WebAssembly](./setup-snapshot.md) from the development snapshot release.
6+
7+
## Prerequisites
8+
9+
- [Visual Studio Code](https://code.visualstudio.com/)
10+
- [Swift for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang)
11+
- [Swift Development Snapshot](https://swift.org/install) (`swift-DEVELOPMENT-SNAPSHOT-2024-09-04-a` or later)
12+
- [Swift SDK for WebAssembly](./setup-snapshot.md)
13+
14+
15+
## Configure your SwiftPM package
16+
17+
1. Open your Swift package in VSCode.
18+
2. Create a `.vscode/settings.json` with the following content:
19+
20+
```json
21+
{
22+
"swift.path": "<path-to-swift-toolchain-from-swift.org>/usr/bin",
23+
}
24+
```
25+
26+
> **Note**: Replace `<path-to-swift-toolchain-from-swift.org>` with the path to the development snapshot Swift toolchain you downloaded from [swift.org/install](https://www.swift.org/install).
27+
28+
3. Create a `.sourcekit-lsp/config.json` with the following content:
29+
30+
```json
31+
{
32+
"swiftPM": {
33+
"swiftSDK": "<Swift SDK id>"
34+
}
35+
}
36+
```
37+
38+
> **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`.
39+
40+
4. Reload the VSCode window by pressing `Cmd + Shift + P` and selecting `Reload Window`.
41+
42+
That's it! You can now build and auto-complete your Swift package using the Swift SDK for WebAssembly.
43+
44+
![](./vscode-editing.png)

0 commit comments

Comments
 (0)