-
Notifications
You must be signed in to change notification settings - Fork 90
Improve documentation #1588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation #1588
Changes from 4 commits
412ffa1
3d7a208
62f62ef
86e1bde
62fd0c0
6c305e6
4310265
d087d90
b2a1f74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Installing Pre-Release Builds | ||
|
|
||
| Try out the latest updates by switching to the pre-release version. | ||
|
|
||
| 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. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The "Switch to Pre-Release Version" button in the VS Code extensions view is used to install the latest pre-release builds: | ||
|
|
||
|  | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| A "Switch to Release Version" button will appear in its place that lets you go back to the official release. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Automatic Task Creation | ||
|
|
||
| Tasks added for common operations with your Package. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| > 💡 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). | ||
| For workspaces that contain a **Package.swift** file, the Swift extension will add the following tasks: | ||
|
|
||
| - **Build All**: Build all targets in the Package | ||
| - **Build Debug <Executable>**: Each executable in a Package.swift get a task for building a debug build | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **Build Release <Executable>**: Each executable in a Package.swift get a task for building a release build | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| These tasks are available via the commands **Terminal ▸ Run Task...** and **Terminal ▸ Run Build Task...** in the command palette. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,11 @@ | ||||||||||||
| # Debugging | ||||||||||||
|
|
||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's subtle, but you might want to include an Availability marker on this page to indicate this works with Swift 6.0+:
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this makes sense to set for debugging. You are able to debug with older toolchains: we just switched to |
||||||||||||
| vscode-swift allows you to debug your Swift packages. | ||||||||||||
| Debug your Swift executables using LLDB. | ||||||||||||
|
|
||||||||||||
| > Tip: Debugging works best when using a version of the Swift toolchain 6.0 or higher | ||||||||||||
| > 💡 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. | ||||||||||||
| > | ||||||||||||
| > Debugging works best when using a version of the Swift toolchain 6.0 or higher. | ||||||||||||
|
|
||||||||||||
| 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. | ||||||||||||
|
|
||||||||||||
| 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. | ||||||||||||
matthewbastien marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
|
|
||||||||||||
| Debugging uses workflows common to all VSCode extensions. For more information see https://code.visualstudio.com/docs/editor/debugging | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Documentation Live Preview | ||
matthewbastien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Show a live preview of your Swift documentation while editing. | ||
|
|
||
| > Note: This feature is only available when using a Swift toolchain 6.2 or higher running on macOS or Linux. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| The Swift toolchain comes with a built-in documentation compiler called DocC that can be used to build documentation for your Swift code. This documentation can then be distributed to developers or other contributors. It's what we used to make the documentation for vscode-swift! You can learn more about DocC by reading [the documentation on the Swift organization's website](https://www.swift.org/documentation/docc/). | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The Swift extension for VS Code can show you a side-by-side live preview of your documentation as you edit it. This feature can be accessed via the Preview Swift Documentation button at the top right of an editor or with the `Swift: Preview Documentation` command in the command palette. This will open up a new editor pane with your rendered documentation: | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|  | ||
matthewbastien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Language Features | ||
|
|
||
| Language features to help you write Swift code. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| > 💡 Tip: Language features are common to all VS Code extensions. See the [VS Code documentation about navigating code](https://code.visualstudio.com/docs/editing/editingevolved) for a more in-depth overview. | ||
| The Swift extension provides language features such as code completion and jump to definition via [SourceKit-LSP](https://github.com/apple/sourcekit-lsp). | ||
|
|
||
| > ⚠️ Important: With Swift toolchains prior to 6.1 you will need to build your project at least once for SourceKit-LSP to function correcly. Whenever you add a new dependency to your project, make sure to rebuild it so that SourceKit-LSP can update its information. | ||
matthewbastien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| SourceKit-LSP provides background indexing in Swift toolchain 6.1 which will automatically index your project on startup. All indexing results are cached in the `.build/index-build` folder within your workspace. | ||
|
|
||
| SourceKit-LSP can be configured via extension settings. See <doc:settings> for more information. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Commands | ||
|
|
||
| Useful VS Code commands added by the Swift extension. | ||
|
|
||
| > 💡 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. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| The Swift extension adds the following commands, each prefixed with `"Swift: "` in the command palette. | ||
|
|
||
| #### Configuration | ||
|
|
||
| - **`Create New Project...`** - Create a new Swift project using a template. This opens a dialog to guide you through creating a new project structure. | ||
| - **`Create New Swift File...`** - Create a new `.swift` file in the current workspace. | ||
| - **`Select Toolchain...`** - Select the locally installed Swift toolchain (including Xcode toolchains on macOS) that you want to use Swift tools from. | ||
|
|
||
| The following command is only available on macOS: | ||
|
|
||
| - **`Select Target Platform...`** - An experimental command available in Swift 6.1 that offers code completion for iOS, tvOS, watchOS, and visionOS projects. | ||
|
|
||
| #### Building and Debugging | ||
|
|
||
| - **`Run Build`** - Run `swift build` for the package associated with the open file. | ||
| - **`Debug Build`** - Run `swift build` with debugging enabled for the package associated with the open file, launching the binary and attaching the debugger. | ||
| - **`Attach to Process...`** - Attach the debugger to an already running process for debugging. | ||
| - **`Clean Build Folder`** - Clean the `.build` folder for the package associated with the open file, removing all previously built products. | ||
|
|
||
| #### Dependency Management | ||
|
|
||
| - **`Resolve Package Dependencies`** - Run `swift package resolve` on packages associated with the open file. | ||
| - **`Update Package Dependencies`** - Run `swift package update` on packages associated with the open file. | ||
| - **`Reset Package Dependencies`** - Run `swift package reset` on packages associated with the open file. | ||
| - **`Add to Workspace`** - Add the current package to the active workspace in VS Code. | ||
| - **`Clean Build`** - Run `swift package clean` on packages associated with the open file. | ||
| - **`Open Package.swift`** - Open `Package.swift` for the package associated with the open file. | ||
| - **`Use Local Version`** - Switch the package dependency to use a local version of the package instead of the remote repository version. | ||
| - **`Edit Locally`** - Make the package dependency editable locally, allowing changes to the dependency to be reflected immediately. | ||
| - **`Revert To Original Version`** - Revert the package dependency to its original, unedited state after local changes have been made. | ||
| - **`View Repository`** - Open the external repository of the selected Swift package in a browser. | ||
|
|
||
| #### Testing | ||
|
|
||
| - **`Test: Run All Tests`** - Run all the tests across all test targes in the open project. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **`Test: Rerun Last Run`** - Perform the last test run again. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **`Test: Open Coverage`** - Open the last generated coverage report, if one exists. | ||
| - **`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). | ||
|
|
||
| #### Snippets and Scripts | ||
|
|
||
| - **`Insert Function Comment`** - Insert a standard comment block for documenting a Swift function in the current file. | ||
| - **`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. | ||
| - **`Run Swift Snippet`** - If the currently open file is a Swift snippet then run it. | ||
| - **`Debug Swift Snippet`** - If the currently open file is a Swift snippet then debug it. | ||
|
|
||
| #### Diagnostics | ||
|
|
||
| - **`Capture Diagnostic Bundle`** - Capture a diagnostic bundle from VS Code, containing logs and information to aid in troubleshooting Swift-related issues. | ||
| - **`Clear Diagnostics Collection`** - Clear all collected diagnostics in the current workspace to start fresh. | ||
| - **`Restart LSP Server`** - Restart the Swift Language Server Protocol (LSP) server for the current workspace. | ||
| - **`Re-Index Project`** - Force a re-index of the project to refresh code completion and symbol navigation support. | ||
matthewbastien marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.