From aabfea4c10b3f65d4b110ba94d40d10b60e7b43d Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Mon, 23 Jun 2025 14:29:20 -0400 Subject: [PATCH] debugger: Document workaround for debugging Swift (#33269) Release Notes: - N/A --- docs/src/debugger.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/src/debugger.md b/docs/src/debugger.md index 5b1a0e5914..fc95fb43b5 100644 --- a/docs/src/debugger.md +++ b/docs/src/debugger.md @@ -18,7 +18,7 @@ Zed supports a variety of debug adapters for different programming languages out - Python ([debugpy](https://github.com/microsoft/debugpy.git)): Provides debugging capabilities for Python applications, supporting features like remote debugging, multi-threaded debugging, and Django/Flask application debugging. -- LLDB ([CodeLLDB](https://github.com/vadimcn/codelldb.git)): A powerful debugger for C, C++, Objective-C, and Swift, offering low-level debugging features and support for Apple platforms. +- LLDB ([CodeLLDB](https://github.com/vadimcn/codelldb.git)): A powerful debugger for Rust, C, C++, and some other compiled languages, offering low-level debugging features and support for Apple platforms. (For Swift, [see below](#swift).) - GDB ([GDB](https://sourceware.org/gdb/)): The GNU Debugger, which supports debugging for multiple programming languages including C, C++, Go, and Rust, across various platforms. @@ -376,6 +376,21 @@ You might find yourself needing to connect to an existing instance of Delve that In such case Zed won't spawn a new instance of Delve, as it opts to use an existing one. The consequence of this is that _there will be no terminal_ in Zed; you have to interact with the Delve instance directly, as it handles stdin/stdout of the debuggee. +#### Swift + +Out-of-the-box support for debugging Swift programs will be provided by the Swift extension for Zed in the near future. In the meantime, the builtin CodeLLDB adapter can be used with some customization. On macOS, you'll need to locate the `lldb-dap` binary that's part of Apple's LLVM toolchain by running `which lldb-dap`, then point Zed to it in your project's `.zed/settings.json`: + +```json +{ + "dap": { + "CodeLLDB": { + "binary": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-dap", // example value, may vary between systems + "args": [] + } + } +} +``` + #### Ruby To run a ruby task in the debugger, you will need to configure it in the `.zed/debug.json` file in your project. We don't yet have automatic detection of ruby tasks, nor do we support connecting to an existing process. @@ -586,7 +601,7 @@ You can pass `binary`, `args`, or both. `binary` should be a path to a _debug ad "dap": { "CodeLLDB": { "binary": "/Users/name/bin/lldb-dap", - "args": ["--settings", "{sourceLanguages:[\"rust\"]}"] + "args": ["--wait-for-debugger"] } } }