1# Swift
2
3Swift language support in Zed is provided by the community-maintained [Swift extension](https://github.com/zed-extensions/swift).
4Report issues to: [https://github.com/zed-extensions/swift/issues](https://github.com/zed-extensions/swift/issues)
5
6- Tree-sitter: [alex-pinkus/tree-sitter-swift](https://github.com/alex-pinkus/tree-sitter-swift)
7- Language Server: [swiftlang/sourcekit-lsp](https://github.com/swiftlang/sourcekit-lsp)
8- Debug Adapter: [`lldb-dap`](https://github.com/swiftlang/llvm-project/blob/next/lldb/tools/lldb-dap/README.md)
9
10## Language Server Configuration
11
12You can modify the behavior of SourceKit LSP by creating a `.sourcekit-lsp/config.json` under your home directory or in your project root. See [SourceKit-LSP configuration file](https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Configuration%20File.md) for complete documentation.
13
14## Debugging
15
16The Swift extension provides a debug adapter for debugging Swift code.
17Zed's name for the adapter (in the UI and `debug.json`) is `Swift`, and under the hood it uses [`lldb-dap`](https://github.com/swiftlang/llvm-project/blob/next/lldb/tools/lldb-dap/README.md), as provided by the Swift toolchain.
18The extension tries to find an `lldb-dap` binary using `swiftly`, using `xcrun`, and by searching `$PATH`, in that order of preference.
19The extension doesn't attempt to download `lldb-dap` if it's not found.
20
21- [lldb-dap configuration documentation](https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/README.md#configuration-settings-reference)
22
23### Examples
24
25#### Build and debug a Swift binary
26
27```json [debug]
28[
29 {
30 "label": "Debug Swift",
31 "build": {
32 "command": "swift",
33 "args": ["build"]
34 },
35 "program": "$ZED_WORKTREE_ROOT/swift-app/.build/arm64-apple-macosx/debug/swift-app",
36 "request": "launch",
37 "adapter": "Swift"
38 }
39]
40```