Skip to content

Commit 62f62ef

Browse files
make documentation more consistent between articles
1 parent 3d7a208 commit 62f62ef

15 files changed

+94
-75
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Installing Pre-Release Builds
2+
3+
Live on the bleeding edge by switching to the pre-release version.
4+
5+
The Swift extension provides pre-release builds that can be used to test out unreleased features or get bug fixes before an official release can be published. Pre-release build numbers are always one minor version ahead of the most recent release.
6+
7+
The "Switch to Pre-Release Version" button in the VS Code extensions view is used to install the latest pre-release builds:
8+
9+
![](install-pre-release.png)
10+
11+
A "Switch to Release Version" button will appear in its place that lets you go back to the official release.

userdocs/userdocs.docc/Articles/Advanced/remote-dev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Visual Studio Code Dev Containers
22

3-
Dev containers can be used as an easy way to develop when building for other platforms.
3+
Create reusable development environments using containers.
44

55
[VS Code Dev Containers](https://code.visualstudio.com/docs/remote/containers) allows you to run your code and environment in a container. This is especially useful for Swift when developing on macOS and deploying to Linux. You can ensure there are no compatibility issues in Foundation when running your code. The extension also works with [GitHub Codespaces](https://github.com/features/codespaces) to allow you to write your code on the web.
66

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Automatic Task Creation
22

3-
vscode-swift automatically adds tasks for common operations with your Package.
3+
Tasks added for common operations with your Package.
44

5-
> Tip: Tasks use workflows common to all VSCode extensions. For more information see https://code.visualstudio.com/docs/editor/tasks
5+
> 💡 Tip: Tasks use workflows common to all VS Code extensions. For more information see [the VS Code documentation for tasks](https://code.visualstudio.com/docs/editor/tasks).
66
7-
For workspaces that contain a **Package.swift** file, this extension will add the following tasks:
7+
For workspaces that contain a **Package.swift** file, the Swift extension will add the following tasks:
88

99
- **Build All**: Build all targets in the Package
1010
- **Build Debug <Executable>**: Each executable in a Package.swift get a task for building a debug build
1111
- **Build Release <Executable>**: Each executable in a Package.swift get a task for building a release build
1212

13-
These tasks are available via **Terminal ▸ Run Task...** and **Terminal ▸ Run Build Task...**.
13+
These tasks are available via the commands **Terminal ▸ Run Task...** and **Terminal ▸ Run Build Task...** in the command palette.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Debugging
22

3-
vscode-swift allows you to debug your Swift packages.
3+
Debug your Swift executables using LLDB.
44

5-
> Tip: Debugging works best when using a version of the Swift toolchain 6.0 or higher
5+
> 💡 Tip: Debugging workflows are common to all VS Code extensions. See the [VS Code documentation about testing](https://code.visualstudio.com/docs/debugtest/testing) for a more in-depth overview.
6+
>
7+
> Debugging works best when using a version of the Swift toolchain 6.0 or higher.
68
79
When you open a Swift package (a directory containing a `Package.swift` file), the extension automatically generates build tasks and launch configurations for each executable within the package. Additionally, if the package includes tests, the extension creates a configuration specifically designed to run those tests. These configurations all leverage the CodeLLDB extension as the debugger of choice.
810

911
Use the **Run > Start Debugging** menu item to run an executable and start debugging. If you have multiple launch configurations you can choose which launch configuration to use in the debugger view.
10-
11-
Debugging uses workflows common to all VSCode extensions. For more information see https://code.visualstudio.com/docs/editor/debugging

userdocs/userdocs.docc/Articles/Features/docc-live-preview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Documentation Live Preview
22

3-
vscode-swift shows you a live preview of your Swift documentation while editing.
3+
Show a live preview of your Swift documentation while editing.
44

55
> Note: This feature is only available when using a Swift toolchain 6.2 or higher running on macOS or Linux.
66
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Language Features
22

3-
vscode-swift provides various language features to help you write Swift code.
3+
Language features to help you write Swift code.
44

5-
The extension provides language features such as code completion and jump to definition via [SourceKit-LSP](https://github.com/apple/sourcekit-lsp). To ensure the extension functions correctly, it’s important to first build the project so that SourceKit-LSP has access to all the symbol data. Whenever you add a new dependency to your project, make sure to rebuild it so that SourceKit-LSP can update its information.
5+
The Swift extension provides language features such as code completion and jump to definition via [SourceKit-LSP](https://github.com/apple/sourcekit-lsp). To ensure the extension functions correctly, it’s important to first build the project so that SourceKit-LSP has access to all the symbol data. Whenever you add a new dependency to your project, make sure to rebuild it so that SourceKit-LSP can update its information.

userdocs/userdocs.docc/Articles/Features/project-view.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Project View
1+
# Swift Project View
22

3-
vscode-swift provides project view
3+
View aspects of your Swift project at a glance.
44

55
If your workspace contains a package, this extension will add a **Swift Project** view to the Explorer:
66

userdocs/userdocs.docc/Articles/Features/test-coverage.md

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
# Test Explorer
1+
# Running and Debugging Tests
22

33
vscode-swift shows test results in the test explorer.
44

5+
> 💡 Tip: The Test Explorer UI is common to all VS Code extensions. See the [VS Code documentation about testing](https://code.visualstudio.com/docs/debugtest/testing) for a more in-depth overview.
6+
57
If your package contains tests then they can be viewed, run and debugged in the Test Explorer.
68

79
![](test-explorer.png)
810

911
Once your project is built, the Test Explorer will list all your tests. These tests are grouped by package, then test target, and finally, by XCTestCase class. From the Test Explorer, you can initiate a test run, debug a test run, and if a file has already been opened, you can jump to the source code for a test.
12+
13+
## Run Tests with Coverage
14+
15+
Test coverage is a measurement of how much of your code is tested by your tests. It defines how many lines of code were actually run when you ran your tests and how many were not. When a line of code is not run by your tests it will not have been tested and perhaps you need to extend your tests.
16+
17+
The Swift extension integrates with VS Code's Code Coverage APIs to record what code has been hit or missed by your tests.
18+
19+
![](coverage-run.png)
20+
21+
Once you've performed a code coverage run a coverage report will be displayed in a section of the primary side bar. This report lists all the source files in your project and what percentage of lines were hit by tests. You can click on each file to open that file in the code editor. If you close the report you can always get it back by running the command `Test: Open Coverage`.
22+
23+
![](coverage-report.png)
24+
25+
After generating code coverage lines numbers in covered files will be coloured red or green depending on if they ran during the test run. Hovering over the line numbers shows how many times each line was run. Hitting the "Toggle Inline Coverage" link that appears when hovering over the line numbers will keep this information visible.
26+
27+
![](coverage-render.png)
Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,58 @@
11
# Commands
22

3-
vscode-swift adds various commands to Visual Studio Code.
3+
Useful VS Code commands added by the Swift extension.
44

5-
The extension adds the following commands, available via the command palette.
5+
> 💡 Tip: Commands can be accessed from the VS Code command palette which is common to all VS Code extensions. See the [VS Code documentation about the command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) for a more in-depth overview.
6+
7+
The Swift extension adds the following commands, each prefixed with `"Swift: "` in the UI.
68

79
#### Configuration
810

9-
- **Create New Project...**: Create a new Swift project using a template. This opens a dialog to guide you through creating a new project structure.
10-
- **Create New Swift File...**: Create a new `.swift` file in the current workspace.
11-
- **Select Toolchain**: Select the locally installed Swift toolchain (including Xcode toolchains on macOS) that you want to use Swift tools from.
11+
- **`Create New Project...`** - Create a new Swift project using a template. This opens a dialog to guide you through creating a new project structure.
12+
- **`Create New Swift File...`** - Create a new `.swift` file in the current workspace.
13+
- **`Select Toolchain...`** - Select the locally installed Swift toolchain (including Xcode toolchains on macOS) that you want to use Swift tools from.
1214

1315
The following command is only available on macOS:
1416

15-
- **Select Target Platform**: This is an experimental command that offers code completion for iOS and tvOS projects.
17+
- **`Select Target Platform...`** - An experimental command that offers code completion for iOS and tvOS projects.
1618

1719
#### Building and Debugging
1820

19-
- **Run Build**: Run `swift build` for the package associated with the open file.
20-
- **Debug Build**: Run `swift build` with debugging enabled for the package associated with the open file, launching the binary and attaching the debugger.
21-
- **Attach to Process...**: Attach the debugger to an already running process for debugging.
22-
- **Clean Build Folder**: Clean the build folder for the package associated with the open file, removing all previously built products.
21+
- **`Run Build`** - Run `swift build` for the package associated with the open file.
22+
- **`Debug Build`** - Run `swift build` with debugging enabled for the package associated with the open file, launching the binary and attaching the debugger.
23+
- **`Attach to Process...`** - Attach the debugger to an already running process for debugging.
24+
- **`Clean Build Folder`** - Clean the build folder for the package associated with the open file, removing all previously built products.
2325

2426
#### Dependency Management
2527

26-
- **Resolve Package Dependencies**: Run `swift package resolve` on packages associated with the open file.
27-
- **Update Package Dependencies**: Run `swift package update` on packages associated with the open file.
28-
- **Reset Package Dependencies**: Run `swift package reset` on packages associated with the open file.
29-
- **Add to Workspace**: Add the current package to the active workspace in VS Code.
30-
- **Clean Build**: Run `swift package clean` on packages associated with the open file.
31-
- **Open Package.swift**: Open `Package.swift` for the package associated with the open file.
32-
- **Use Local Version**: Switch the package dependency to use a local version of the package instead of the remote repository version.
33-
- **Edit Locally**: Make the package dependency editable locally, allowing changes to the dependency to be reflected immediately.
34-
- **Revert To Original Version**: Revert the package dependency to its original, unedited state after local changes have been made.
35-
- **View Repository**: Open the external repository of the selected Swift package in a browser.
28+
- **`Resolve Package Dependencies`** - Run `swift package resolve` on packages associated with the open file.
29+
- **`Update Package Dependencies`** - Run `swift package update` on packages associated with the open file.
30+
- **`Reset Package Dependencies`** - Run `swift package reset` on packages associated with the open file.
31+
- **`Add to Workspace`** - Add the current package to the active workspace in VS Code.
32+
- **`Clean Build`** - Run `swift package clean` on packages associated with the open file.
33+
- **`Open Package.swift`** - Open `Package.swift` for the package associated with the open file.
34+
- **`Use Local Version`** - Switch the package dependency to use a local version of the package instead of the remote repository version.
35+
- **`Edit Locally`** - Make the package dependency editable locally, allowing changes to the dependency to be reflected immediately.
36+
- **`Revert To Original Version`** - Revert the package dependency to its original, unedited state after local changes have been made.
37+
- **`View Repository`** - Open the external repository of the selected Swift package in a browser.
3638

3739
#### Testing
3840

39-
- **Test: Run All Tests**: Run all the tests across all test targes in the open project.
40-
- **Test: Rerun Last Run**: Perform the last test run again.
41-
- **Test: Open Coverage**: Open the last generated coverage report, if one exists.
42-
- **Test: Run All Tests in Parallel**: Run all tests in parallel. This action only affects XCTests. Swift-testing tests are parallel by default, and their parallelism [is controlled in code](https://developer.apple.com/documentation/testing/parallelization).
41+
- **`Test: Run All Tests`** - Run all the tests across all test targes in the open project.
42+
- **`Test: Rerun Last Run`** - Perform the last test run again.
43+
- **`Test: Open Coverage`** - Open the last generated coverage report, if one exists.
44+
- **`Test: Run All Tests in Parallel`** - Run all tests in parallel. This action only affects XCTests. Swift-testing tests are parallel by default, and their parallelism [is controlled in code](https://developer.apple.com/documentation/testing/parallelization).
4345

4446
#### Snippets and Scripts
4547

46-
- **Insert Function Comment**: Insert a standard comment block for documenting a Swift function in the current file.
47-
- **Run Swift Script**: Run the currently open file, as a Swift script. The file must not be part of a build target. If the file has not been saved it will save it to a temporary file so it can be run.
48-
- **Run Swift Snippet**: If the currently open file is a Swift snippet then run it.
49-
- **Debug Swift Snippet**: If the currently open file is a Swift snippet then debug it.
48+
- **`Insert Function Comment`** - Insert a standard comment block for documenting a Swift function in the current file.
49+
- **`Run Swift Script`** - Run the currently open file, as a Swift script. The file must not be part of a build target. If the file has not been saved it will save it to a temporary file so it can be run.
50+
- **`Run Swift Snippet`** - If the currently open file is a Swift snippet then run it.
51+
- **`Debug Swift Snippet`** - If the currently open file is a Swift snippet then debug it.
5052

5153
#### Diagnostics
5254

53-
- **Capture VS Code Swift Diagnostic Bundle**: Capture a diagnostic bundle from VS Code, containing logs and information to aid in troubleshooting Swift-related issues.
54-
- **Clear Diagnostics Collection**: Clear all collected diagnostics in the current workspace to start fresh.
55-
- **Restart LSP Server**: Restart the Swift Language Server Protocol (LSP) server for the current workspace.
56-
- **Re-Index Project**: Force a re-index of the project to refresh code completion and symbol navigation support.
55+
- **`Capture Diagnostic Bundle`** - Capture a diagnostic bundle from VS Code, containing logs and information to aid in troubleshooting Swift-related issues.
56+
- **`Clear Diagnostics Collection`** - Clear all collected diagnostics in the current workspace to start fresh.
57+
- **`Restart LSP Server`** - Restart the Swift Language Server Protocol (LSP) server for the current workspace.
58+
- **`Re-Index Project`** - Force a re-index of the project to refresh code completion and symbol navigation support.

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
vscode-swift provides various settings to configure its behaviour.
44

5-
The Visual Studio Code Swift extension comes with a number of settings you can use to control how it works. Detailed descriptions of each setting is provided in the extension settings page.
5+
> 💡 Tip: The Settings UI is common to all VS Code extensions. See the [VS Code documentation about personalizing VS Code](https://code.visualstudio.com/docs/getstarted/personalize-vscode) for a more in-depth overview.
6+
7+
The Swift extension comes with a number of settings you can use to control how it works. Detailed descriptions of each setting are provided in the extension settings page.
68

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

@@ -65,13 +67,15 @@ Alternatively you can specfiy which specific command the arguments should apply
6567

6668
## SourceKit-LSP
6769

68-
[SourceKit-LSP](https://github.com/apple/sourcekit-lsp) is the language server used by the the Swift extension to provide symbol completion, jump to definition etc. It is developed by Apple to provide Swift and C language support for any editor that supports the Language Server Protocol.
70+
[SourceKit-LSP](https://github.com/apple/sourcekit-lsp) is the language server used by the the Swift extension to provide symbol completion, jump to definition, etc. It is developed by Apple to provide Swift and C language support for any editor that supports the Language Server Protocol.
6971

7072
### Background Indexing
7173

72-
If you're using a nightly (`main`) or recent `6.0` toolchain you can enable support for background indexing in Sourcekit-LSP. This removes the need to do a build before getting code completion and diagnostics.
74+
Background Indexing was added as an experimental feature in Swift toolchain version 6.0 and then enabled by default in 6.1. This feature removes the need to do a build before getting code completion and diagnostics.
75+
76+
On startup, SourceKit-LSP will read your project information from your `Package.swift` and begin indexing your project automatically. All indexing results are cached in the `.build/index-build` folder within your workspace.
7377

74-
To enable support, set the [`swift.sourcekit-lsp.backgroundIndexing`](vscode://settings/swift.sourcekit-lsp.backgroundIndexing) setting to `true`.
78+
To enable or disable this feature you can use the [`swift.sourcekit-lsp.backgroundIndexing`](vscode://settings/swift.sourcekit-lsp.backgroundIndexing) setting.
7579

7680
### Support for 'Expand Macro'
7781

userdocs/userdocs.docc/Articles/Topics/installation.md

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

3-
vscode-code Swift is installed through the extension marketplace.
3+
Install the Swift extension via the VS Code Marketplace.
44

55
The Swift extension is supported on macOS, Linux, and Windows.
66

0 commit comments

Comments
 (0)