debugger: Remove feature flag
This commit is contained in:
parent
5405c2c2d3
commit
82dfa82ba7
5 changed files with 226 additions and 271 deletions
|
@ -3,7 +3,6 @@ use std::any::TypeId;
|
||||||
use dap::debugger_settings::DebuggerSettings;
|
use dap::debugger_settings::DebuggerSettings;
|
||||||
use debugger_panel::{DebugPanel, ToggleFocus};
|
use debugger_panel::{DebugPanel, ToggleFocus};
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
use feature_flags::{DebuggerFeatureFlag, FeatureFlagViewExt};
|
|
||||||
use gpui::{App, DispatchPhase, EntityInputHandler, actions};
|
use gpui::{App, DispatchPhase, EntityInputHandler, actions};
|
||||||
use new_process_modal::{NewProcessModal, NewProcessMode};
|
use new_process_modal::{NewProcessModal, NewProcessMode};
|
||||||
use project::debugger::{self, breakpoint_store::SourceBreakpoint, session::ThreadStatus};
|
use project::debugger::{self, breakpoint_store::SourceBreakpoint, session::ThreadStatus};
|
||||||
|
@ -62,12 +61,7 @@ pub fn init(cx: &mut App) {
|
||||||
DebuggerSettings::register(cx);
|
DebuggerSettings::register(cx);
|
||||||
workspace::FollowableViewRegistry::register::<DebugSession>(cx);
|
workspace::FollowableViewRegistry::register::<DebugSession>(cx);
|
||||||
|
|
||||||
cx.observe_new(|_: &mut Workspace, window, cx| {
|
cx.observe_new(|workspace: &mut Workspace, _, _| {
|
||||||
let Some(window) = window else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
cx.when_flag_enabled::<DebuggerFeatureFlag>(window, |workspace, _, _| {
|
|
||||||
workspace
|
workspace
|
||||||
.register_action(spawn_task_or_modal)
|
.register_action(spawn_task_or_modal)
|
||||||
.register_action(|workspace, _: &ToggleFocus, window, cx| {
|
.register_action(|workspace, _: &ToggleFocus, window, cx| {
|
||||||
|
@ -165,24 +159,20 @@ pub fn init(cx: &mut App) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(existing) = workspace.item_of_type::<StackTraceView>(cx)
|
if let Some(existing) = workspace.item_of_type::<StackTraceView>(cx) {
|
||||||
{
|
|
||||||
let is_active = workspace
|
let is_active = workspace
|
||||||
.active_item(cx)
|
.active_item(cx)
|
||||||
.is_some_and(|item| item.item_id() == existing.item_id());
|
.is_some_and(|item| item.item_id() == existing.item_id());
|
||||||
workspace
|
workspace.activate_item(&existing, true, !is_active, window, cx);
|
||||||
.activate_item(&existing, true, !is_active, window, cx);
|
|
||||||
} else {
|
} else {
|
||||||
let Some(active_session) =
|
let Some(active_session) = debug_panel.read(cx).active_session()
|
||||||
debug_panel.read(cx).active_session()
|
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let project = workspace.project();
|
let project = workspace.project();
|
||||||
|
|
||||||
let stack_trace_view =
|
let stack_trace_view = active_session.update(cx, |session, cx| {
|
||||||
active_session.update(cx, |session, cx| {
|
|
||||||
session.stack_trace_view(project, window, cx).clone()
|
session.stack_trace_view(project, window, cx).clone()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -229,7 +219,6 @@ pub fn init(cx: &mut App) {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
})
|
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
cx.observe_new({
|
cx.observe_new({
|
||||||
|
|
|
@ -73,7 +73,7 @@ use element::{AcceptEditPredictionBinding, LineWithInvisibles, PositionMap, layo
|
||||||
pub use element::{
|
pub use element::{
|
||||||
CursorLayout, EditorElement, HighlightedRange, HighlightedRangeLine, PointForPosition,
|
CursorLayout, EditorElement, HighlightedRange, HighlightedRangeLine, PointForPosition,
|
||||||
};
|
};
|
||||||
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt};
|
use feature_flags::FeatureFlagAppExt;
|
||||||
use futures::{
|
use futures::{
|
||||||
FutureExt, StreamExt as _,
|
FutureExt, StreamExt as _,
|
||||||
future::{self, Shared, join},
|
future::{self, Shared, join},
|
||||||
|
@ -5969,7 +5969,6 @@ impl Editor {
|
||||||
buffer: &Entity<Buffer>,
|
buffer: &Entity<Buffer>,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Task<Vec<task::DebugScenario>> {
|
) -> Task<Vec<task::DebugScenario>> {
|
||||||
if cx.has_flag::<DebuggerFeatureFlag>() {
|
|
||||||
maybe!({
|
maybe!({
|
||||||
let project = self.project.as_ref()?;
|
let project = self.project.as_ref()?;
|
||||||
let dap_store = project.read(cx).dap_store();
|
let dap_store = project.read(cx).dap_store();
|
||||||
|
@ -6005,9 +6004,6 @@ impl Editor {
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| Task::ready(vec![]))
|
.unwrap_or_else(|| Task::ready(vec![]))
|
||||||
} else {
|
|
||||||
Task::ready(vec![])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn code_actions(
|
fn code_actions(
|
||||||
|
@ -10155,9 +10151,6 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if !cx.has_flag::<DebuggerFeatureFlag>() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let source = self
|
let source = self
|
||||||
.buffer
|
.buffer
|
||||||
.read(cx)
|
.read(cx)
|
||||||
|
|
|
@ -32,7 +32,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind};
|
use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind};
|
||||||
use collections::{BTreeMap, HashMap};
|
use collections::{BTreeMap, HashMap};
|
||||||
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt};
|
use feature_flags::FeatureFlagAppExt;
|
||||||
use file_icons::FileIcons;
|
use file_icons::FileIcons;
|
||||||
use git::{
|
use git::{
|
||||||
Oid,
|
Oid,
|
||||||
|
@ -567,13 +567,11 @@ impl EditorElement {
|
||||||
register_action(editor, window, Editor::insert_uuid_v4);
|
register_action(editor, window, Editor::insert_uuid_v4);
|
||||||
register_action(editor, window, Editor::insert_uuid_v7);
|
register_action(editor, window, Editor::insert_uuid_v7);
|
||||||
register_action(editor, window, Editor::open_selections_in_multibuffer);
|
register_action(editor, window, Editor::open_selections_in_multibuffer);
|
||||||
if cx.has_flag::<DebuggerFeatureFlag>() {
|
|
||||||
register_action(editor, window, Editor::toggle_breakpoint);
|
register_action(editor, window, Editor::toggle_breakpoint);
|
||||||
register_action(editor, window, Editor::edit_log_breakpoint);
|
register_action(editor, window, Editor::edit_log_breakpoint);
|
||||||
register_action(editor, window, Editor::enable_breakpoint);
|
register_action(editor, window, Editor::enable_breakpoint);
|
||||||
register_action(editor, window, Editor::disable_breakpoint);
|
register_action(editor, window, Editor::disable_breakpoint);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn register_key_listeners(&self, window: &mut Window, _: &mut App, layout: &EditorLayout) {
|
fn register_key_listeners(&self, window: &mut Window, _: &mut App, layout: &EditorLayout) {
|
||||||
let position_map = layout.position_map.clone();
|
let position_map = layout.position_map.clone();
|
||||||
|
@ -8173,13 +8171,11 @@ impl Element for EditorElement {
|
||||||
let mut breakpoint_rows = self.editor.update(cx, |editor, cx| {
|
let mut breakpoint_rows = self.editor.update(cx, |editor, cx| {
|
||||||
editor.active_breakpoints(start_row..end_row, window, cx)
|
editor.active_breakpoints(start_row..end_row, window, cx)
|
||||||
});
|
});
|
||||||
if cx.has_flag::<DebuggerFeatureFlag>() {
|
|
||||||
for (display_row, (_, bp, state)) in &breakpoint_rows {
|
for (display_row, (_, bp, state)) in &breakpoint_rows {
|
||||||
if bp.is_enabled() && state.is_none_or(|s| s.verified) {
|
if bp.is_enabled() && state.is_none_or(|s| s.verified) {
|
||||||
active_rows.entry(*display_row).or_default().breakpoint = true;
|
active_rows.entry(*display_row).or_default().breakpoint = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let line_numbers = self.layout_line_numbers(
|
let line_numbers = self.layout_line_numbers(
|
||||||
Some(&gutter_hitbox),
|
Some(&gutter_hitbox),
|
||||||
|
@ -8198,7 +8194,6 @@ impl Element for EditorElement {
|
||||||
// We add the gutter breakpoint indicator to breakpoint_rows after painting
|
// We add the gutter breakpoint indicator to breakpoint_rows after painting
|
||||||
// line numbers so we don't paint a line number debug accent color if a user
|
// line numbers so we don't paint a line number debug accent color if a user
|
||||||
// has their mouse over that line when a breakpoint isn't there
|
// has their mouse over that line when a breakpoint isn't there
|
||||||
if cx.has_flag::<DebuggerFeatureFlag>() {
|
|
||||||
self.editor.update(cx, |editor, _| {
|
self.editor.update(cx, |editor, _| {
|
||||||
if let Some(phantom_breakpoint) = &mut editor
|
if let Some(phantom_breakpoint) = &mut editor
|
||||||
.gutter_breakpoint_indicator
|
.gutter_breakpoint_indicator
|
||||||
|
@ -8215,13 +8210,11 @@ impl Element for EditorElement {
|
||||||
Bias::Right,
|
Bias::Right,
|
||||||
);
|
);
|
||||||
let breakpoint = Breakpoint::new_standard();
|
let breakpoint = Breakpoint::new_standard();
|
||||||
phantom_breakpoint.collides_with_existing_breakpoint =
|
phantom_breakpoint.collides_with_existing_breakpoint = false;
|
||||||
false;
|
|
||||||
(position, breakpoint, None)
|
(position, breakpoint, None)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
|
||||||
|
|
||||||
let mut expand_toggles =
|
let mut expand_toggles =
|
||||||
window.with_element_namespace("expand_toggles", |window| {
|
window.with_element_namespace("expand_toggles", |window| {
|
||||||
|
@ -8690,8 +8683,7 @@ impl Element for EditorElement {
|
||||||
let show_breakpoints = snapshot
|
let show_breakpoints = snapshot
|
||||||
.show_breakpoints
|
.show_breakpoints
|
||||||
.unwrap_or(gutter_settings.breakpoints);
|
.unwrap_or(gutter_settings.breakpoints);
|
||||||
let breakpoints = if cx.has_flag::<DebuggerFeatureFlag>() && show_breakpoints {
|
let breakpoints = self.layout_breakpoints(
|
||||||
self.layout_breakpoints(
|
|
||||||
line_height,
|
line_height,
|
||||||
start_row..end_row,
|
start_row..end_row,
|
||||||
scroll_pixel_position,
|
scroll_pixel_position,
|
||||||
|
@ -8703,10 +8695,7 @@ impl Element for EditorElement {
|
||||||
&row_infos,
|
&row_infos,
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
)
|
);
|
||||||
} else {
|
|
||||||
vec![]
|
|
||||||
};
|
|
||||||
|
|
||||||
self.layout_signature_help(
|
self.layout_signature_help(
|
||||||
&hitbox,
|
&hitbox,
|
||||||
|
|
|
@ -77,11 +77,6 @@ impl FeatureFlag for NotebookFeatureFlag {
|
||||||
const NAME: &'static str = "notebooks";
|
const NAME: &'static str = "notebooks";
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DebuggerFeatureFlag {}
|
|
||||||
impl FeatureFlag for DebuggerFeatureFlag {
|
|
||||||
const NAME: &'static str = "debugger";
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ThreadAutoCaptureFeatureFlag {}
|
pub struct ThreadAutoCaptureFeatureFlag {}
|
||||||
impl FeatureFlag for ThreadAutoCaptureFeatureFlag {
|
impl FeatureFlag for ThreadAutoCaptureFeatureFlag {
|
||||||
const NAME: &'static str = "thread-auto-capture";
|
const NAME: &'static str = "thread-auto-capture";
|
||||||
|
|
|
@ -20,7 +20,6 @@ use collections::VecDeque;
|
||||||
use debugger_ui::debugger_panel::DebugPanel;
|
use debugger_ui::debugger_panel::DebugPanel;
|
||||||
use editor::ProposedChangesEditorToolbar;
|
use editor::ProposedChangesEditorToolbar;
|
||||||
use editor::{Editor, MultiBuffer, scroll::Autoscroll};
|
use editor::{Editor, MultiBuffer, scroll::Autoscroll};
|
||||||
use feature_flags::{DebuggerFeatureFlag, FeatureFlagViewExt};
|
|
||||||
use futures::future::Either;
|
use futures::future::Either;
|
||||||
use futures::{StreamExt, channel::mpsc, select_biased};
|
use futures::{StreamExt, channel::mpsc, select_biased};
|
||||||
use git_ui::git_panel::GitPanel;
|
use git_ui::git_panel::GitPanel;
|
||||||
|
@ -481,6 +480,7 @@ fn initialize_panels(
|
||||||
workspace_handle.clone(),
|
workspace_handle.clone(),
|
||||||
cx.clone(),
|
cx.clone(),
|
||||||
);
|
);
|
||||||
|
let debug_panel = DebugPanel::load(workspace_handle.clone(), cx);
|
||||||
|
|
||||||
let (
|
let (
|
||||||
project_panel,
|
project_panel,
|
||||||
|
@ -490,6 +490,7 @@ fn initialize_panels(
|
||||||
channels_panel,
|
channels_panel,
|
||||||
chat_panel,
|
chat_panel,
|
||||||
notification_panel,
|
notification_panel,
|
||||||
|
debug_panel,
|
||||||
) = futures::try_join!(
|
) = futures::try_join!(
|
||||||
project_panel,
|
project_panel,
|
||||||
outline_panel,
|
outline_panel,
|
||||||
|
@ -498,6 +499,7 @@ fn initialize_panels(
|
||||||
channels_panel,
|
channels_panel,
|
||||||
chat_panel,
|
chat_panel,
|
||||||
notification_panel,
|
notification_panel,
|
||||||
|
debug_panel,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
workspace_handle.update_in(cx, |workspace, window, cx| {
|
workspace_handle.update_in(cx, |workspace, window, cx| {
|
||||||
|
@ -508,21 +510,8 @@ fn initialize_panels(
|
||||||
workspace.add_panel(channels_panel, window, cx);
|
workspace.add_panel(channels_panel, window, cx);
|
||||||
workspace.add_panel(chat_panel, window, cx);
|
workspace.add_panel(chat_panel, window, cx);
|
||||||
workspace.add_panel(notification_panel, window, cx);
|
workspace.add_panel(notification_panel, window, cx);
|
||||||
cx.when_flag_enabled::<DebuggerFeatureFlag>(window, |_, window, cx| {
|
|
||||||
cx.spawn_in(
|
|
||||||
window,
|
|
||||||
async move |workspace: gpui::WeakEntity<Workspace>,
|
|
||||||
cx: &mut AsyncWindowContext| {
|
|
||||||
let debug_panel = DebugPanel::load(workspace.clone(), cx).await?;
|
|
||||||
workspace.update_in(cx, |workspace, window, cx| {
|
|
||||||
workspace.add_panel(debug_panel, window, cx);
|
workspace.add_panel(debug_panel, window, cx);
|
||||||
})?;
|
})?;
|
||||||
anyhow::Ok(())
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.detach()
|
|
||||||
});
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let is_assistant2_enabled = !cfg!(test);
|
let is_assistant2_enabled = !cfg!(test);
|
||||||
let agent_panel = if is_assistant2_enabled {
|
let agent_panel = if is_assistant2_enabled {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue