You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: userdocs/userdocs.docc/Articles/Reference/settings.md
+58Lines changed: 58 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,64 @@ The Swift extension comes with a number of settings you can use to control how i
8
8
9
9
This document outlines useful configuration options not covered by the settings descriptions in the extension settings page.
10
10
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
+
11
69
## Command Plugins
12
70
13
71
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