Swift for Visual Studio CodeThis extension adds language support for Swift to Visual Studio Code. It supports:
Swift support uses SourceKit LSP for the language server to power code completion and LLDB to enable debugging. The extension is developed by members of the Swift Community and maintained by the SSWG. The aim is to provide a first-class, feature complete extension to make developing Swift applications on all platforms a seamless experience. If you experience any issues or want to propose new features please create an issue or post on the ContributingThe Swift for Visual Studio Code extension is a community driven project, developed by the amazing Swift community. Any kind of contribution is appreciated, including code, tests and documentation. For more details see CONTRIBUTING.md. InstallationFor the extension to work, you must have Swift installed on your system. Please see the Getting Started Guide on Swift.org for details on how to install Swift on your system. Install the extension from VS Code Marketplace and open a Swift package! You'll be prompted to install and configure the CodeLLDB extension, which you should do so. FeaturesLanguage featuresThe extension provides language features such as code completion and jump to definition via the Apple project SourceKit-LSP. For these to work fully it is required that the project has been built at least once. Every time you add a new dependency to your project you should build it so SourceKit-LSP can extract the symbol data for that dependency. Automatic task creationFor workspaces that contain a Package.swift file, this extension will create the following tasks:
These tasks are available via Terminal ▸ Run Task... and Terminal ▸ Run Build Task.... CommandsThe extension adds commands, available via the command palette.
The following command is only available on macOS
Package dependenciesIf your workspace contains a package that has dependencies, this extension will add a Package Dependencies view to the Explorer: Additionally, the extension will monitor Package.swift and Package.resolved for changes, resolve any changes to the dependencies, and update the view as needed. DebuggingThe Swift extension uses the CodeLLDB extension for debugging. When you open a Swift package (a directory containing a Package.swift) the extension creates build tasks and launch configurations for each executable. If the package contains tests, the extension creates a configuration to run the tests. These all use the CodeLLDB extension as a debugger. Press CodeLLDB has a version of Test ExplorerIf your package contains tests then they can be viewed, run and debugged in the Test Explorer. Once your project has been built the Test Explorer will be able to list all your tests. These are grouped by package, then test target and finally 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 for a test. Documentation |