Debugger implementation (#13433)
### DISCLAIMER > As of 6th March 2025, debugger is still in development. We plan to merge it behind a staff-only feature flag for staff use only, followed by non-public release and then finally a public one (akin to how Git panel release was handled). This is done to ensure the best experience when it gets released. ### END OF DISCLAIMER **The current state of the debugger implementation:** https://github.com/user-attachments/assets/c4deff07-80dd-4dc6-ad2e-0c252a478fe9 https://github.com/user-attachments/assets/e1ed2345-b750-4bb6-9c97-50961b76904f ---- All the todo's are in the following channel, so it's easier to work on this together: https://zed.dev/channel/zed-debugger-11370 If you are on Linux, you can use the following command to join the channel: ```cli zed https://zed.dev/channel/zed-debugger-11370 ``` ## Current Features - Collab - Breakpoints - Sync when you (re)join a project - Sync when you add/remove a breakpoint - Sync active debug line - Stack frames - Click on stack frame - View variables that belong to the stack frame - Visit the source file - Restart stack frame (if adapter supports this) - Variables - Loaded sources - Modules - Controls - Continue - Step back - Stepping granularity (configurable) - Step into - Stepping granularity (configurable) - Step over - Stepping granularity (configurable) - Step out - Stepping granularity (configurable) - Debug console - Breakpoints - Log breakpoints - line breakpoints - Persistent between zed sessions (configurable) - Multi buffer support - Toggle disable/enable all breakpoints - Stack frames - Click on stack frame - View variables that belong to the stack frame - Visit the source file - Show collapsed stack frames - Restart stack frame (if adapter supports this) - Loaded sources - View all used loaded sources if supported by adapter. - Modules - View all used modules (if adapter supports this) - Variables - Copy value - Copy name - Copy memory reference - Set value (if adapter supports this) - keyboard navigation - Debug Console - See logs - View output that was sent from debug adapter - Output grouping - Evaluate code - Updates the variable list - Auto completion - If not supported by adapter, we will show auto-completion for existing variables - Debug Terminal - Run custom commands and change env values right inside your Zed terminal - Attach to process (if adapter supports this) - Process picker - Controls - Continue - Step back - Stepping granularity (configurable) - Step into - Stepping granularity (configurable) - Step over - Stepping granularity (configurable) - Step out - Stepping granularity (configurable) - Disconnect - Restart - Stop - Warning when a debug session exited without hitting any breakpoint - Debug view to see Adapter/RPC log messages - Testing - Fake debug adapter - Fake requests & events --- Release Notes: - N/A --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: Anthony Eid <hello@anthonyeid.me> Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com> Co-authored-by: Piotr <piotr@zed.dev>
This commit is contained in:
parent
ed4e654fdf
commit
41a60ffecf
156 changed files with 25840 additions and 451 deletions
|
@ -1,11 +1,12 @@
|
|||
use anyhow::Context as _;
|
||||
use collections::HashMap;
|
||||
use dap::adapters::DebugAdapterName;
|
||||
use fs::Fs;
|
||||
use gpui::{App, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter};
|
||||
use lsp::LanguageServerName;
|
||||
use paths::{
|
||||
local_settings_file_relative_path, local_tasks_file_relative_path,
|
||||
local_vscode_tasks_file_relative_path, EDITORCONFIG_NAME,
|
||||
local_debug_file_relative_path, local_settings_file_relative_path,
|
||||
local_tasks_file_relative_path, local_vscode_tasks_file_relative_path, EDITORCONFIG_NAME,
|
||||
};
|
||||
use rpc::{
|
||||
proto::{self, FromProto, ToProto},
|
||||
|
@ -15,7 +16,7 @@ use schemars::JsonSchema;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use settings::{
|
||||
parse_json_with_comments, InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation,
|
||||
SettingsSources, SettingsStore,
|
||||
SettingsSources, SettingsStore, TaskKind,
|
||||
};
|
||||
use std::{path::Path, sync::Arc, time::Duration};
|
||||
use task::{TaskTemplates, VsCodeTaskFile};
|
||||
|
@ -40,6 +41,10 @@ pub struct ProjectSettings {
|
|||
#[serde(default)]
|
||||
pub lsp: HashMap<LanguageServerName, LspSettings>,
|
||||
|
||||
/// Configuration for Debugger-related features
|
||||
#[serde(default)]
|
||||
pub dap: HashMap<DebugAdapterName, DapSettings>,
|
||||
|
||||
/// Configuration for Diagnostics-related features.
|
||||
#[serde(default)]
|
||||
pub diagnostics: DiagnosticsSettings,
|
||||
|
@ -61,6 +66,12 @@ pub struct ProjectSettings {
|
|||
pub session: SessionSettings,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct DapSettings {
|
||||
pub binary: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct NodeBinarySettings {
|
||||
/// The path to the Node binary.
|
||||
|
@ -483,7 +494,7 @@ impl SettingsObserver {
|
|||
)
|
||||
.unwrap(),
|
||||
);
|
||||
(settings_dir, LocalSettingsKind::Tasks)
|
||||
(settings_dir, LocalSettingsKind::Tasks(TaskKind::Script))
|
||||
} else if path.ends_with(local_vscode_tasks_file_relative_path()) {
|
||||
let settings_dir = Arc::<Path>::from(
|
||||
path.ancestors()
|
||||
|
@ -495,7 +506,19 @@ impl SettingsObserver {
|
|||
)
|
||||
.unwrap(),
|
||||
);
|
||||
(settings_dir, LocalSettingsKind::Tasks)
|
||||
(settings_dir, LocalSettingsKind::Tasks(TaskKind::Script))
|
||||
} else if path.ends_with(local_debug_file_relative_path()) {
|
||||
let settings_dir = Arc::<Path>::from(
|
||||
path.ancestors()
|
||||
.nth(
|
||||
local_debug_file_relative_path()
|
||||
.components()
|
||||
.count()
|
||||
.saturating_sub(1),
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
(settings_dir, LocalSettingsKind::Tasks(TaskKind::Debug))
|
||||
} else if path.ends_with(EDITORCONFIG_NAME) {
|
||||
let Some(settings_dir) = path.parent().map(Arc::from) else {
|
||||
continue;
|
||||
|
@ -616,7 +639,7 @@ impl SettingsObserver {
|
|||
}
|
||||
}
|
||||
}),
|
||||
LocalSettingsKind::Tasks => task_store.update(cx, |task_store, cx| {
|
||||
LocalSettingsKind::Tasks(task_kind) => task_store.update(cx, |task_store, cx| {
|
||||
task_store
|
||||
.update_user_tasks(
|
||||
Some(SettingsLocation {
|
||||
|
@ -624,6 +647,7 @@ impl SettingsObserver {
|
|||
path: directory.as_ref(),
|
||||
}),
|
||||
file_content.as_deref(),
|
||||
task_kind,
|
||||
cx,
|
||||
)
|
||||
.log_err();
|
||||
|
@ -648,7 +672,7 @@ impl SettingsObserver {
|
|||
pub fn local_settings_kind_from_proto(kind: proto::LocalSettingsKind) -> LocalSettingsKind {
|
||||
match kind {
|
||||
proto::LocalSettingsKind::Settings => LocalSettingsKind::Settings,
|
||||
proto::LocalSettingsKind::Tasks => LocalSettingsKind::Tasks,
|
||||
proto::LocalSettingsKind::Tasks => LocalSettingsKind::Tasks(TaskKind::Script),
|
||||
proto::LocalSettingsKind::Editorconfig => LocalSettingsKind::Editorconfig,
|
||||
}
|
||||
}
|
||||
|
@ -656,7 +680,7 @@ pub fn local_settings_kind_from_proto(kind: proto::LocalSettingsKind) -> LocalSe
|
|||
pub fn local_settings_kind_to_proto(kind: LocalSettingsKind) -> proto::LocalSettingsKind {
|
||||
match kind {
|
||||
LocalSettingsKind::Settings => proto::LocalSettingsKind::Settings,
|
||||
LocalSettingsKind::Tasks => proto::LocalSettingsKind::Tasks,
|
||||
LocalSettingsKind::Tasks(_) => proto::LocalSettingsKind::Tasks,
|
||||
LocalSettingsKind::Editorconfig => proto::LocalSettingsKind::Editorconfig,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue