Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/acp_thread/src/acp_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ impl AcpThread {
text_diff(old_text.as_str(), &content)
.into_iter()
.map(|(range, replacement)| {
(snapshot.anchor_range_between(range), replacement)
(snapshot.anchor_range_around(range), replacement)
})
.collect::<Vec<_>>()
})
Expand Down
36 changes: 32 additions & 4 deletions crates/agent_ui/src/agent_panel.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
use std::{ops::Range, path::Path, rc::Rc, sync::Arc, time::Duration};
use std::{
ops::Range,
path::Path,
rc::Rc,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
},
time::Duration,
};

use acp_thread::{AcpThread, AgentSessionInfo, MentionUri};
use agent::{ContextServerRegistry, SharedThread, ThreadStore};
Expand Down Expand Up @@ -241,7 +250,14 @@ pub fn init(cx: &mut App) {
window.dispatch_action(workspace::RestoreBanner.boxed_clone(), cx);
window.refresh();
})
.register_action(|_workspace, _: &ResetTrialUpsell, _window, cx| {
.register_action(|workspace, _: &ResetTrialUpsell, _window, cx| {
if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, _| {
panel
.on_boarding_upsell_dismissed
.store(false, Ordering::Release);
});
}
OnboardingUpsell::set_dismissed(false, cx);
})
.register_action(|_workspace, _: &ResetTrialEndUpsell, _window, cx| {
Expand Down Expand Up @@ -524,6 +540,7 @@ pub struct AgentPanel {
selected_agent: AgentType,
show_trust_workspace_message: bool,
last_configuration_error_telemetry: Option<String>,
on_boarding_upsell_dismissed: AtomicBool,
}

impl AgentPanel {
Expand Down Expand Up @@ -743,11 +760,19 @@ impl AgentPanel {
.ok();
});

let weak_panel = cx.entity().downgrade();
let onboarding = cx.new(|cx| {
AgentPanelOnboarding::new(
user_store.clone(),
client,
|_window, cx| {
move |_window, cx| {
weak_panel
.update(cx, |panel, _| {
panel
.on_boarding_upsell_dismissed
.store(true, Ordering::Release);
})
.ok();
OnboardingUpsell::set_dismissed(true, cx);
},
cx,
Expand Down Expand Up @@ -803,6 +828,7 @@ impl AgentPanel {
selected_agent: AgentType::default(),
show_trust_workspace_message: false,
last_configuration_error_telemetry: None,
on_boarding_upsell_dismissed: AtomicBool::new(OnboardingUpsell::dismissed()),
};

// Initial sync of agent servers from extensions
Expand Down Expand Up @@ -2773,7 +2799,7 @@ impl AgentPanel {
}

fn should_render_onboarding(&self, cx: &mut Context<Self>) -> bool {
if OnboardingUpsell::dismissed() {
if self.on_boarding_upsell_dismissed.load(Ordering::Acquire) {
return false;
}

Expand All @@ -2786,6 +2812,8 @@ impl AgentPanel {
.is_some_and(|date| date < chrono::Utc::now())
{
OnboardingUpsell::set_dismissed(true, cx);
self.on_boarding_upsell_dismissed
.store(true, Ordering::Release);
return false;
}

Expand Down
10 changes: 5 additions & 5 deletions crates/text/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2403,13 +2403,13 @@ impl BufferSnapshot {
}
}

/// Returns an anchor range for the given input position range that is anchored to the text inbetween.
pub fn anchor_range_between<T: ToOffset>(&self, position: Range<T>) -> Range<Anchor> {
self.anchor_before(position.start)..self.anchor_after(position.end)
/// Returns an anchor range for the given input position range that is anchored to the text in the range.
pub fn anchor_range_around<T: ToOffset>(&self, position: Range<T>) -> Range<Anchor> {
self.anchor_after(position.start)..self.anchor_before(position.end)
}

/// Returns an anchor range for the given input position range that is anchored to the text before the start position and after the end position.
pub fn anchor_range_around<T: ToOffset>(&self, position: Range<T>) -> Range<Anchor> {
/// Returns an anchor range for the given input position range that is anchored to the text before and after.
pub fn anchor_range_between<T: ToOffset>(&self, position: Range<T>) -> Range<Anchor> {
self.anchor_before(position.start)..self.anchor_after(position.end)
}

Expand Down