Skip to content

Commit 6da80aa

Browse files
committed
Add user documentation
Include multi-project setup notes as excluding only makes sense in that context
1 parent 1d024a5 commit 6da80aa

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

userdocs/userdocs.docc/Articles/Reference/settings.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,64 @@ The Swift extension comes with a number of settings you can use to control how i
88

99
This document outlines useful configuration options not covered by the settings descriptions in the extension settings page.
1010

11+
## Workspace Setup
12+
13+
### Multiple packages in workspace folder
14+
15+
If the workspace folder you open in VS Code contains multiple Swift packages:
16+
```
17+
<workspace folder>
18+
/proj1
19+
/Package.swift
20+
/proj2
21+
/Package.swift
22+
/aSubfolder
23+
/proj3
24+
/Package.swift
25+
```
26+
27+
You can enable the `searchSubfoldersForPackages` setting so the Swift extension can initializing all these projects.
28+
```json
29+
{
30+
"swift.searchSubfoldersForPackages": true,
31+
}
32+
```
33+
34+
Additionally you can exclude individual packages from initializing:
35+
```json
36+
{
37+
"swift.exclude": {
38+
"**/proj2": true,
39+
"**/aSubfolder": true,
40+
"**/aSubfolder/proj3": false,
41+
},
42+
}
43+
```
44+
45+
### Multi-root Workspaces
46+
47+
As an alternative to opening [a single workspace folder with multiple packages in it](#multiple-packages-in-workspace-folder), VS Code has a concept of [multi-root workspaces](https://code.visualstudio.com/docs/editing/workspaces/multi-root-workspaces) which the Swift extension supports.
48+
49+
Ex. myProj.code-workspace
50+
```json
51+
{
52+
"folders": [
53+
{
54+
"name": "proj1",
55+
"path": "./proj1"
56+
},
57+
{
58+
"name": "proj3",
59+
"path": "./aSubfolder/proj3"
60+
},
61+
],
62+
"settings": {
63+
"swift.autoGenerateLaunchConfigurations": false,
64+
"swift.debugger.debugAdapter": "lldb-dap",
65+
}
66+
}
67+
```
68+
1169
## Command Plugins
1270

1371
Swift packages can define [command plugins](https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/Plugins.md) that can perform arbitrary tasks. For example, the [swift-format](https://github.com/swiftlang/swift-format) package exposes a `format-source-code` command which will use swift-format to format source code in a folder. These plugin commands can be invoked from VS Code using `> Swift: Run Command Plugin`.

0 commit comments

Comments
 (0)