Another stab at #35388
cc @Sansui233
Closes#35388
Release Notes:
- debugger: Fixed Python debug sessions failing to launch due to a
missing debugpy installation.
Closes#35388
Release Notes:
- debugger: Fixed Python debug sessions failing to launch due to a
missing debugpy installation. Debugpy is now installed into user's venv
if there's one available.
@cole-miller found a root cause of our struggles with attach scenarios;
we did not fetch .so files necessary for attaching to work,
as we were downloading DebugPy source tarballs from GitHub.
This PR does away with it by setting up a virtualenv instead that has
debugpy installed.
Closes#34660Closes#34575
Release Notes:
- debugger: Fixed attaching with DebugPy. DebugPy is now installed
automatically from pip (instead of GitHub), unless it is present in
active virtual environment. Additionally this should resolve any startup
issues with missing .so on Linux.
Previously we would append `js-debug/src/dapDebugServer.js` to the value
of the `dap.JavaScript.binary` setting and `src/debugpy/adapter` to the
value of the `dap.Debugpy.binary` setting, which isn't particularly
intuitive. This PR fixes that.
Release Notes:
- debugger: Made the semantics of the `dap.$ADAPTER.binary` setting more
intuitive for the `JavaScript` and `Debugpy` adapters. In the new
semantics, this should be the path to `dapDebugServer.js` for
`JavaScript` and the path to the `src/debugpy/adapter` directory for
`Debugpy`.
---------
Co-authored-by: Remco Smits <djsmits12@gmail.com>
This PR updates the debugger panel's session list to be more useful in
some cases that are commonly hit when using the JavaScript adapter. We
make two adjustments, which only apply to JavaScript sessions:
- For a child session that's the only child of a root session, we
collapse it with its parent. This imitates what VS Code does in the
"call stack" view for JavaScript sessions.
- When a session has exactly one thread, we label the session with that
thread's name, instead of the session label provided by the DAP. VS Code
also makes this adjustment, which surfaces more useful information when
working with browser sessions.
Closes#33072
Release Notes:
- debugger: Improved the appearance of JavaScript sessions in the debug
panel's session list.
---------
Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
This commit removes the PHP debug adapter in favor of a new version
(0.3.0) of PHP extension.
The name of a debug adapter has been changed from "PHP" to "Xdebug",
which makes this a breaking change in user-configured scenarios
Release Notes:
- debugger: PHP debug adapter is no longer shipped in core Zed editor;
it is now available in PHP extension (starting with version 0.3.0). The
adapter has been renamed from `PHP` to `Xdebug`, which might break your
user-defined debug scenarios.
There were a couple of things preventing this from working:
- our hack to stop the node REPL from appearing broke in recent versions
of the JS DAP that started passing `--experimental-network-inspection`
by default
- we had lost the ability to create a debug terminal without specifying
a program
This PR fixes those issues. We also fixed environment variables from the
**runInTerminal** request not getting passed to the spawned program.
Release Notes:
- Debugger: Fix RunInTerminal not working for JavaScript debugger.
---------
Co-authored-by: Cole Miller <cole@zed.dev>
`program` isn't required, and in fact our built-in `JavaScript debug
terminal` configuration doesn't have it.
Also add `node-terminal` to the list of allowed types.
Co-authored-by: Michael <michael@zed.dev>
Release Notes:
- N/A
Just like vscode-js-debug, debugpy uses the `name` key in
StartDebuggingRequestArguments for this:
0d65353cc6/src/debugpy/adapter/clients.py (L753)
Release Notes:
- debugger: Made the names of Python subprocesses in the session list
more helpful.
Related to #33072
We use the JS adapter's suggested names for child sessions, but
sometimes it sends us `""`, so don't use that one.
Release Notes:
- debugger: Fixed nameless child sessions appearing with the JavaScript
adapter.
- **debugger: Update exception breakpoints list on capability update**
- **Do not prefill codelldb sourcelanguages by default**
Release Notes:
- debugger: CodeLLDB no longer enables pretty-printers for Rust by
default. This fixes pretty-printers for C++. This is a breaking change
for user-defined debug scenarios from debug.json; in order to enable
Rust pretty printing when using CodeLLDB, add `"sourceLanguages":
["rust"]` to your debug configuration. This change does not affect
scenarios automatically inferred by Zed.
---------
Co-authored-by: Anthony Eid <anthony@zed.dev>
Now that the extension version has been bumped we can remove our in-tree
one to avoid having duplicate debug adapters.
Release Notes:
- The ruby debug adapter has been moved to the [ruby
extension](https://github.com/zed-extensions/ruby), if you have any
saved debug scenarios you'll need to change `"adapter": "Ruby"` to
`"adapter": "rdbg"`.
- Normalize `node-terminal` to `pwa-node` before sending to DAP
- Split `command` into `program` and `args`
- Run in external console
Release Notes:
- debugger: Fixed debugging JavaScript tasks that used `"type":
"node-terminal"`.
## Context
To support inline values a language will have to implement their own
provider trait that walks through tree sitter nodes. This is overly
complicated, hard to accurately implement for each language, and lacks
proper extension support.
This PR switches to a singular inline provider that uses a language's
`debugger.scm` query field to capture variables and scopes. The inline
provider is able to use this information to generate inlays that take
scope into account and work with any language that defines a debugger
query file.
### Todos
- [x] Implement a utility test function to easily test inline values
- [x] Generate inline values based on captures
- [x] Reimplement Python, Rust, and Go support
- [x] Take scope into account when iterating through variable captures
- [x] Add tests for Go inline values
- [x] Remove old inline provider code and trait implementations
Release Notes:
- debugger: Generate inline values based on a language debugger.scm file
Custom arguments replace any arguments that we normally pass to the DAP.
For interpreted languages, they are passed to the interpreter after the
DAP path or module. They can be combined with a custom binary, or you
can omit `dap.binary` and just customize the arguments to the DAPs we
download.
This doesn't take care of updating the extension API to support custom
arguments.
Release Notes:
- debugger: Implemented support for passing custom arguments to a debug
adapter binary using the `dap.args` setting.
- debugger: Fixed not being able to use the `dap` setting in
`.zed/settings.json`.
We were translating port configuration incorrectly, using it for both
attach target and debugger port.
This however meant that we were spawning a 2nd process that'd listen on
the same port as the existing debugger.
Closes#32836
Release Notes:
- debugger: Fixed issues with auto-translated Visual Studio Code debug
configs for attaching to existing node debugger instances.
- DAP schemas will be stored in `debug_adapters_schemas` subdirectory in
extension work dir.
- Added Debug Config integration and such.
Release Notes:
- N/A
Closes #ISSUE
Release Notes:
- Go debug scenarios can now use an externally-managed Delve instance.
Use `tcp_connection` in your debug scenario definition to provide
adapter's address.
Send `runtimeExecutable` and `runtimeArgs` instead of `program` and
`args` to avoid the DAP implicitly wrapping the command in `node`.
This means that putting `pnpm vitest <file>` as the command in the
launch modal will work, as will this in debug.json:
```
[
{
"adapter": "JavaScript",
"type": "pwa-node",
"label": "Label",
"request": "launch",
"program": "pnpm",
"args": ["vitest", "<file>"],
"cwd": "/Users/name/project"
}
]
```
Release Notes:
- Debugger Beta: made it possible to use commands like `pnpm
<subcommand> <args>` in the launch modal and debug.json
After this PR we can run all the in-tree launch.json examples from [this
repo](https://github.com/microsoft/vscode-recipes).
Things done:
- Fill in default cwd at a lower level for all adapters
- Update launch.json parsing for DebugScenario changes
- Imitate how VS Code normalizes the `type` field for JS debug tasks
- Make version field optional
- Extend the variable replacer a bit
Release Notes:
- Debugger Beta: fixed issues preventing loading and running of debug
tasks from VS Code's launch.json.
---------
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This allows us to support debugging with a debug adapter not managed by
Zed. Note that this is not a user facing change, as DebugAdapterBinary
is used to determine how to spawn a debugger. Thus, this should not
break any configs or anything like that.
Closes #ISSUE
Release Notes:
- N/A
Also introduces an extension point for other adapters to do this if it
turns out they also send this information.
Release Notes:
- N/A (JS locator is still gated)
Closes#32018
Release Notes:
- Fixed issues with launching Python debug adapter downloaded by Zed.
You might need to clear the old install of Debugpy from
`$HOME/.local/share/zed/debug_adapters/Debugpy` (Linux) or
`$HOME/Library/Application Support/Zed/debug_adapters/Debugpy` (Mac).
When we moved to schema-based debug configs, we've added validate_config
- a trait method
that is supposed to both validate the configuration and determine
whether it is a launch configuration
or an attach configuration.
The validation bit is a bit problematic though - we received reports on
Discords about
scenarios not starting up properly; it turned out that Javascript's
implementation was overly strict.
Thus, I got rid of any code that tries to validate the config - let's
let the debug adapter itself
decide whether it can digest the configuration or not. validate_config
is now left unimplemented for most
DebugAdapter implementations (except for PHP), because all adapters use
`request`: 'launch'/'attach' for that.
Let's leave the trait method in place though, as nothing guarantees this
to be true for all adapters.
cc @Anthony-Eid
Release Notes:
- debugger: Improved error messages when the debug scenario is not
valid.
- debugger: Fixed cases where valid configs were rejected.
With this, a semi-working debug session is possible from the JS/TS
gutter tasks:
https://github.com/user-attachments/assets/8db6ed29-b44a-4314-ae8b-a8213291bffc
For now, available in debug builds only as a base to improve on later on
the DAP front.
Release Notes:
- N/A
---------
Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Closes #ISSUE
Release Notes:
- debugger: Fixed wrong path being picked up for delve on Windows
- debugger: Fixed delve not respecting the user-provided binary path
from settings.
This PR also shows more completion items when defining a debug config in
a `debug.json` file. Mainly when using a pre build task argument.
### Follow ups
- Add docs for Go, JS, PHP
- Add attach docs
Release Notes:
- debugger beta: Show build task completions when editing a debug.json
configuration with a pre build task
- debugger beta: Add Python and Native Code debug config
[examples](https://zed.dev/docs/debugger)
test that check's that each conversion works properly based on the
adapter's config validation function.
Co-authored-by: Zed AI \<ai@zed.dev\>
Release Notes:
- debugger beta: Fix bug where Go/GDB configuration's wouldn't work from
NewSessionModal