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
|
@ -18,9 +18,10 @@ use breadcrumbs::Breadcrumbs;
|
|||
use client::{zed_urls, ZED_URL_SCHEME};
|
||||
use collections::VecDeque;
|
||||
use command_palette_hooks::CommandPaletteFilter;
|
||||
use debugger_ui::debugger_panel::DebugPanel;
|
||||
use editor::ProposedChangesEditorToolbar;
|
||||
use editor::{scroll::Autoscroll, Editor, MultiBuffer};
|
||||
use feature_flags::FeatureFlagAppExt;
|
||||
use feature_flags::{Debugger, FeatureFlagAppExt, FeatureFlagViewExt};
|
||||
use futures::{channel::mpsc, select_biased, StreamExt};
|
||||
use git_ui::git_panel::GitPanel;
|
||||
use git_ui::project_diff::ProjectDiffToolbar;
|
||||
|
@ -35,7 +36,10 @@ use migrate::{MigrationBanner, MigrationEvent, MigrationNotification, MigrationT
|
|||
use migrator::{migrate_keymap, migrate_settings};
|
||||
pub use open_listener::*;
|
||||
use outline_panel::OutlinePanel;
|
||||
use paths::{local_settings_file_relative_path, local_tasks_file_relative_path};
|
||||
use paths::{
|
||||
local_debug_file_relative_path, local_settings_file_relative_path,
|
||||
local_tasks_file_relative_path,
|
||||
};
|
||||
use project::{DirectoryLister, ProjectItem};
|
||||
use project_panel::ProjectPanel;
|
||||
use prompt_store::PromptBuilder;
|
||||
|
@ -45,9 +49,9 @@ use release_channel::{AppCommitSha, ReleaseChannel};
|
|||
use rope::Rope;
|
||||
use search::project_search::ProjectSearchBar;
|
||||
use settings::{
|
||||
initial_project_settings_content, initial_tasks_content, update_settings_file,
|
||||
InvalidSettingsError, KeymapFile, KeymapFileLoadResult, Settings, SettingsStore,
|
||||
DEFAULT_KEYMAP_PATH, VIM_KEYMAP_PATH,
|
||||
initial_debug_tasks_content, initial_project_settings_content, initial_tasks_content,
|
||||
update_settings_file, InvalidSettingsError, KeymapFile, KeymapFileLoadResult, Settings,
|
||||
SettingsStore, DEFAULT_KEYMAP_PATH, VIM_KEYMAP_PATH,
|
||||
};
|
||||
use std::any::TypeId;
|
||||
use std::path::PathBuf;
|
||||
|
@ -83,7 +87,9 @@ actions!(
|
|||
OpenDefaultSettings,
|
||||
OpenProjectSettings,
|
||||
OpenProjectTasks,
|
||||
OpenProjectDebugTasks,
|
||||
OpenTasks,
|
||||
OpenDebugTasks,
|
||||
ResetDatabase,
|
||||
ShowAll,
|
||||
ToggleFullScreen,
|
||||
|
@ -429,6 +435,17 @@ fn initialize_panels(
|
|||
workspace.add_panel(channels_panel, window, cx);
|
||||
workspace.add_panel(chat_panel, window, cx);
|
||||
workspace.add_panel(notification_panel, window, cx);
|
||||
cx.when_flag_enabled::<Debugger>(window, |_, window, cx| {
|
||||
cx.spawn_in(window, |workspace, mut cx| async move {
|
||||
let debug_panel = DebugPanel::load(workspace.clone(), cx.clone()).await?;
|
||||
workspace.update_in(&mut cx, |workspace, window, cx| {
|
||||
workspace.add_panel(debug_panel, window, cx);
|
||||
})?;
|
||||
Result::<_, anyhow::Error>::Ok(())
|
||||
})
|
||||
.detach()
|
||||
});
|
||||
|
||||
let entity = cx.entity();
|
||||
let project = workspace.project().clone();
|
||||
let app_state = workspace.app_state().clone();
|
||||
|
@ -703,10 +720,7 @@ fn register_actions(
|
|||
},
|
||||
)
|
||||
.register_action(
|
||||
move |_: &mut Workspace,
|
||||
_: &zed_actions::OpenKeymap,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>| {
|
||||
move |_: &mut Workspace, _: &zed_actions::OpenKeymap, window, cx| {
|
||||
open_settings_file(
|
||||
paths::keymap_file(),
|
||||
|| settings::initial_keymap_content().as_ref().into(),
|
||||
|
@ -715,47 +729,40 @@ fn register_actions(
|
|||
);
|
||||
},
|
||||
)
|
||||
.register_action(move |_: &mut Workspace, _: &OpenSettings, window, cx| {
|
||||
open_settings_file(
|
||||
paths::settings_file(),
|
||||
|| settings::initial_user_settings_content().as_ref().into(),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.register_action(
|
||||
move |_: &mut Workspace,
|
||||
_: &OpenSettings,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>| {
|
||||
open_settings_file(
|
||||
paths::settings_file(),
|
||||
|| settings::initial_user_settings_content().as_ref().into(),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
},
|
||||
)
|
||||
.register_action(
|
||||
|_: &mut Workspace,
|
||||
_: &OpenAccountSettings,
|
||||
_: &mut Window,
|
||||
cx: &mut Context<Workspace>| {
|
||||
|_: &mut Workspace, _: &OpenAccountSettings, _: &mut Window, cx| {
|
||||
cx.open_url(&zed_urls::account_url(cx));
|
||||
},
|
||||
)
|
||||
.register_action(
|
||||
move |_: &mut Workspace,
|
||||
_: &OpenTasks,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>| {
|
||||
open_settings_file(
|
||||
paths::tasks_file(),
|
||||
|| settings::initial_tasks_content().as_ref().into(),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
},
|
||||
)
|
||||
.register_action(move |_: &mut Workspace, _: &OpenTasks, window, cx| {
|
||||
open_settings_file(
|
||||
paths::tasks_file(),
|
||||
|| settings::initial_tasks_content().as_ref().into(),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.register_action(move |_: &mut Workspace, _: &OpenDebugTasks, window, cx| {
|
||||
open_settings_file(
|
||||
paths::debug_tasks_file(),
|
||||
|| settings::initial_debug_tasks_content().as_ref().into(),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.register_action(open_project_settings_file)
|
||||
.register_action(open_project_tasks_file)
|
||||
.register_action(open_project_debug_tasks_file)
|
||||
.register_action(
|
||||
move |workspace: &mut Workspace,
|
||||
_: &zed_actions::OpenDefaultKeymap,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>| {
|
||||
move |workspace, _: &zed_actions::OpenDefaultKeymap, window, cx| {
|
||||
open_bundled_file(
|
||||
workspace,
|
||||
settings::default_keymap(),
|
||||
|
@ -766,21 +773,16 @@ fn register_actions(
|
|||
);
|
||||
},
|
||||
)
|
||||
.register_action(
|
||||
move |workspace: &mut Workspace,
|
||||
_: &OpenDefaultSettings,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>| {
|
||||
open_bundled_file(
|
||||
workspace,
|
||||
settings::default_settings(),
|
||||
"Default Settings",
|
||||
"JSON",
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
},
|
||||
)
|
||||
.register_action(move |workspace, _: &OpenDefaultSettings, window, cx| {
|
||||
open_bundled_file(
|
||||
workspace,
|
||||
settings::default_settings(),
|
||||
"Default Settings",
|
||||
"JSON",
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.register_action(
|
||||
|workspace: &mut Workspace,
|
||||
_: &project_panel::ToggleFocus,
|
||||
|
@ -928,6 +930,8 @@ fn initialize_pane(
|
|||
toolbar.add_item(project_search_bar, window, cx);
|
||||
let lsp_log_item = cx.new(|_| language_tools::LspLogToolbarItemView::new());
|
||||
toolbar.add_item(lsp_log_item, window, cx);
|
||||
let dap_log_item = cx.new(|_| debugger_tools::DapLogToolbarItemView::new());
|
||||
toolbar.add_item(dap_log_item, window, cx);
|
||||
let syntax_tree_item = cx.new(|_| language_tools::SyntaxTreeToolbarItemView::new());
|
||||
toolbar.add_item(syntax_tree_item, window, cx);
|
||||
let migration_banner = cx.new(|cx| MigrationBanner::new(workspace, cx));
|
||||
|
@ -1519,6 +1523,21 @@ fn open_project_tasks_file(
|
|||
)
|
||||
}
|
||||
|
||||
fn open_project_debug_tasks_file(
|
||||
workspace: &mut Workspace,
|
||||
_: &OpenProjectDebugTasks,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Workspace>,
|
||||
) {
|
||||
open_local_file(
|
||||
workspace,
|
||||
local_debug_file_relative_path(),
|
||||
initial_debug_tasks_content(),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
fn open_local_file(
|
||||
workspace: &mut Workspace,
|
||||
settings_relative_path: &'static Path,
|
||||
|
@ -4277,6 +4296,11 @@ mod tests {
|
|||
repl::init(app_state.fs.clone(), cx);
|
||||
repl::notebook::init(cx);
|
||||
tasks_ui::init(cx);
|
||||
project::debugger::breakpoint_store::BreakpointStore::init(
|
||||
&app_state.client.clone().into(),
|
||||
);
|
||||
project::debugger::dap_store::DapStore::init(&app_state.client.clone().into());
|
||||
debugger_ui::init(cx);
|
||||
initialize_workspace(app_state.clone(), prompt_builder, cx);
|
||||
search::init(cx);
|
||||
app_state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue