Compare commits
2 Commits
git-integr
...
data-break
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61da7007b9 | ||
|
|
8867debd0a |
@@ -772,11 +772,11 @@ pub struct Editor {
|
|||||||
expect_bounds_change: Option<Bounds<Pixels>>,
|
expect_bounds_change: Option<Bounds<Pixels>>,
|
||||||
tasks: BTreeMap<(BufferId, BufferRow), RunnableTasks>,
|
tasks: BTreeMap<(BufferId, BufferRow), RunnableTasks>,
|
||||||
tasks_update_task: Option<Task<()>>,
|
tasks_update_task: Option<Task<()>>,
|
||||||
pub breakpoint_store: Option<Entity<BreakpointStore>>,
|
breakpoint_store: Option<Entity<BreakpointStore>>,
|
||||||
/// Allow's a user to create a breakpoint by selecting this indicator
|
/// Allow's a user to create a breakpoint by selecting this indicator
|
||||||
/// It should be None while a user is not hovering over the gutter
|
/// It should be None while a user is not hovering over the gutter
|
||||||
/// Otherwise it represents the point that the breakpoint will be shown
|
/// Otherwise it represents the point that the breakpoint will be shown
|
||||||
pub gutter_breakpoint_indicator: Option<DisplayPoint>,
|
gutter_breakpoint_indicator: (Option<(DisplayPoint, bool)>, Option<Task<()>>),
|
||||||
in_project_search: bool,
|
in_project_search: bool,
|
||||||
previous_search_ranges: Option<Arc<[Range<Anchor>]>>,
|
previous_search_ranges: Option<Arc<[Range<Anchor>]>>,
|
||||||
breadcrumb_header: Option<String>,
|
breadcrumb_header: Option<String>,
|
||||||
@@ -1535,7 +1535,7 @@ impl Editor {
|
|||||||
tasks: Default::default(),
|
tasks: Default::default(),
|
||||||
|
|
||||||
breakpoint_store,
|
breakpoint_store,
|
||||||
gutter_breakpoint_indicator: None,
|
gutter_breakpoint_indicator: (None, None),
|
||||||
_subscriptions: vec![
|
_subscriptions: vec![
|
||||||
cx.observe(&buffer, Self::on_buffer_changed),
|
cx.observe(&buffer, Self::on_buffer_changed),
|
||||||
cx.subscribe_in(&buffer, window, Self::on_buffer_event),
|
cx.subscribe_in(&buffer, window, Self::on_buffer_event),
|
||||||
@@ -6267,7 +6267,8 @@ impl Editor {
|
|||||||
let (color, icon) = {
|
let (color, icon) = {
|
||||||
let color = if self
|
let color = if self
|
||||||
.gutter_breakpoint_indicator
|
.gutter_breakpoint_indicator
|
||||||
.is_some_and(|point| point.row() == row)
|
.0
|
||||||
|
.is_some_and(|(point, is_visible)| is_visible && point.row() == row)
|
||||||
{
|
{
|
||||||
Color::Hint
|
Color::Hint
|
||||||
} else if breakpoint.is_disabled() {
|
} else if breakpoint.is_disabled() {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ use std::{
|
|||||||
ops::{Deref, Range},
|
ops::{Deref, Range},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
|
time::Duration,
|
||||||
};
|
};
|
||||||
use sum_tree::Bias;
|
use sum_tree::Bias;
|
||||||
use text::BufferId;
|
use text::BufferId;
|
||||||
@@ -893,7 +894,6 @@ impl EditorElement {
|
|||||||
let modifiers = event.modifiers;
|
let modifiers = event.modifiers;
|
||||||
let gutter_hovered = gutter_hitbox.is_hovered(window);
|
let gutter_hovered = gutter_hitbox.is_hovered(window);
|
||||||
editor.set_gutter_hovered(gutter_hovered, cx);
|
editor.set_gutter_hovered(gutter_hovered, cx);
|
||||||
editor.gutter_breakpoint_indicator = None;
|
|
||||||
editor.mouse_cursor_hidden = false;
|
editor.mouse_cursor_hidden = false;
|
||||||
|
|
||||||
if gutter_hovered {
|
if gutter_hovered {
|
||||||
@@ -910,8 +910,38 @@ impl EditorElement {
|
|||||||
.buffer_for_excerpt(buffer_anchor.excerpt_id)
|
.buffer_for_excerpt(buffer_anchor.excerpt_id)
|
||||||
.is_some_and(|buffer| buffer.file().is_some())
|
.is_some_and(|buffer| buffer.file().is_some())
|
||||||
{
|
{
|
||||||
editor.gutter_breakpoint_indicator = Some(new_point);
|
let was_hovered = editor.gutter_breakpoint_indicator.0.is_some();
|
||||||
|
let is_visible = editor
|
||||||
|
.gutter_breakpoint_indicator
|
||||||
|
.0
|
||||||
|
.map_or(false, |(_, is_active)| is_active);
|
||||||
|
editor.gutter_breakpoint_indicator.0 = Some((new_point, is_visible));
|
||||||
|
|
||||||
|
editor.gutter_breakpoint_indicator.1.get_or_insert_with(|| {
|
||||||
|
cx.spawn(async move |this, cx| {
|
||||||
|
if !was_hovered {
|
||||||
|
cx.background_executor()
|
||||||
|
.timer(Duration::from_millis(200))
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update(cx, |this, cx| {
|
||||||
|
if let Some((_, is_active)) =
|
||||||
|
this.gutter_breakpoint_indicator.0.as_mut()
|
||||||
|
{
|
||||||
|
*is_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cx.notify();
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
editor.gutter_breakpoint_indicator = (None, None);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
editor.gutter_breakpoint_indicator = (None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
@@ -6836,8 +6866,10 @@ impl Element for EditorElement {
|
|||||||
// 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::<Debugger>() {
|
if cx.has_flag::<Debugger>() {
|
||||||
let gutter_breakpoint_indicator =
|
let gutter_breakpoint_indicator =
|
||||||
self.editor.read(cx).gutter_breakpoint_indicator;
|
self.editor.read(cx).gutter_breakpoint_indicator.0;
|
||||||
if let Some(gutter_breakpoint_point) = gutter_breakpoint_indicator {
|
if let Some((gutter_breakpoint_point, _)) =
|
||||||
|
gutter_breakpoint_indicator.filter(|(_, is_active)| *is_active)
|
||||||
|
{
|
||||||
breakpoint_rows
|
breakpoint_rows
|
||||||
.entry(gutter_breakpoint_point.row())
|
.entry(gutter_breakpoint_point.row())
|
||||||
.or_insert_with(|| {
|
.or_insert_with(|| {
|
||||||
|
|||||||
@@ -16,13 +16,10 @@ use dap::{
|
|||||||
adapters::{DapStatus, DebugAdapterName},
|
adapters::{DapStatus, DebugAdapterName},
|
||||||
client::SessionId,
|
client::SessionId,
|
||||||
messages::Message,
|
messages::Message,
|
||||||
requests::{
|
requests::{Completions, Evaluate, Request as _, RunInTerminal, StartDebugging},
|
||||||
Completions, Evaluate, Request as _, RunInTerminal, SetExpression, SetVariable,
|
|
||||||
StartDebugging,
|
|
||||||
},
|
|
||||||
Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse,
|
Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse,
|
||||||
EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments,
|
EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments,
|
||||||
SetExpressionArguments, SetVariableArguments, Source, StartDebuggingRequestArguments,
|
Source, StartDebuggingRequestArguments,
|
||||||
};
|
};
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use futures::{
|
use futures::{
|
||||||
@@ -710,59 +707,6 @@ impl DapStore {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
pub fn set_variable_value(
|
|
||||||
&self,
|
|
||||||
session_id: &SessionId,
|
|
||||||
stack_frame_id: u64,
|
|
||||||
variables_reference: u64,
|
|
||||||
name: String,
|
|
||||||
value: String,
|
|
||||||
evaluate_name: Option<String>,
|
|
||||||
cx: &mut Context<Self>,
|
|
||||||
) -> Task<Result<()>> {
|
|
||||||
let Some(client) = self
|
|
||||||
.session_by_id(session_id)
|
|
||||||
.and_then(|client| client.read(cx).adapter_client())
|
|
||||||
else {
|
|
||||||
return Task::ready(Err(anyhow!("Could not find client: {:?}", session_id)));
|
|
||||||
};
|
|
||||||
|
|
||||||
let supports_set_expression = self
|
|
||||||
.capabilities_by_id(session_id, cx)
|
|
||||||
.and_then(|caps| caps.supports_set_expression)
|
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
cx.background_executor().spawn(async move {
|
|
||||||
if let Some(evaluate_name) = supports_set_expression.then(|| evaluate_name).flatten() {
|
|
||||||
client
|
|
||||||
.request::<SetExpression>(SetExpressionArguments {
|
|
||||||
expression: evaluate_name,
|
|
||||||
value,
|
|
||||||
frame_id: Some(stack_frame_id),
|
|
||||||
format: None,
|
|
||||||
})
|
|
||||||
.await?;
|
|
||||||
} else {
|
|
||||||
client
|
|
||||||
.request::<SetVariable>(SetVariableArguments {
|
|
||||||
variables_reference,
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
format: None,
|
|
||||||
})
|
|
||||||
.await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// .. get the client and what not
|
|
||||||
// let _ = client.modules(); // This can fire a request to a dap adapter or be a cheap getter.
|
|
||||||
// client.wait_for_request(request::Modules); // This ensures that the request that we've fired off runs to completions
|
|
||||||
// let returned_value = client.modules(); // this is a cheap getter.
|
|
||||||
|
|
||||||
pub fn shutdown_sessions(&mut self, cx: &mut Context<Self>) -> Task<()> {
|
pub fn shutdown_sessions(&mut self, cx: &mut Context<Self>) -> Task<()> {
|
||||||
let mut tasks = vec![];
|
let mut tasks = vec![];
|
||||||
for session_id in self.sessions.keys().cloned().collect::<Vec<_>>() {
|
for session_id in self.sessions.keys().cloned().collect::<Vec<_>>() {
|
||||||
|
|||||||
Reference in New Issue
Block a user