Skip to content

Commit ba7b03c

Browse files
authored
Add a VSCode devcontainer definition (#916)
1 parent a671e5a commit ba7b03c

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.devcontainer/Readme.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Using VSCode devcontainers
2+
3+
Official tutorial: https://code.visualstudio.com/docs/devcontainers/tutorial
4+
5+
### Recommended Settings for macOS
6+
7+
Some of these are defaults:
8+
- Recommended settings for macOS (some of these are defaults):
9+
- General:
10+
- "Choose file sharing implementation for your containers": VirtioFS (better IO performance)
11+
- Resources:
12+
- CPUs: Allow docker to use most or all of your CPUs
13+
- Memory: Allow docker to use most or all of your memory

.devcontainer/default/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM swiftlang/swift:nightly-main-jammy
2+
3+
RUN \
4+
# Disable apt interactive prompts for this RUN command
5+
export DEBIAN_FRONTEND="noninteractive" && \
6+
# Update apt package list
7+
apt-get update && \
8+
# Install sourcekit-lsp dependencies
9+
apt-get install -y libsqlite3-dev libncurses5-dev python3
10+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Reference: https://containers.dev/implementors/json_reference/
2+
{
3+
"name": "SourceKit-LSP",
4+
"dockerFile": "Dockerfile",
5+
6+
// Allow the processes in the container to attach a debugger
7+
"capAdd": [ "SYS_PTRACE" ],
8+
"securityOpt": [ "seccomp=unconfined" ],
9+
10+
"mounts": [
11+
// Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume)
12+
"source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/.build,type=volume",
13+
// Do the same for experimental background indexing
14+
"source=${localWorkspaceFolderBasename}-index-build,target=${containerWorkspaceFolder}/.index-build,type=volume"
15+
],
16+
"customizations": {
17+
"vscode": {
18+
"extensions": [
19+
"sswg.swift-lang"
20+
],
21+
"settings": {
22+
"lldb.library": "/usr/lib/liblldb.so",
23+
"swift.buildArguments": [
24+
"-Xcxx",
25+
"-I/usr/lib/swift",
26+
"-Xcxx",
27+
"-I/usr/lib/swift/Block"
28+
]
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)