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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile-collab
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1.2

FROM rust:1.87-bookworm as builder
FROM rust:1.88-bookworm as builder
WORKDIR app
COPY . .

Expand Down
6 changes: 0 additions & 6 deletions crates/agent_ui/src/buffer_codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,15 +1094,9 @@ mod tests {
};
use language_model::{LanguageModelRegistry, TokenUsage};
use rand::prelude::*;
use serde::Serialize;
use settings::SettingsStore;
use std::{future, sync::Arc};

#[derive(Serialize)]
pub struct DummyCompletionRequest {
pub name: String,
}

#[gpui::test(iterations = 10)]
async fn test_transform_autoindent(cx: &mut TestAppContext, mut rng: StdRng) {
init_test(cx);
Expand Down
101 changes: 1 addition & 100 deletions crates/agent_ui/src/text_thread_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use workspace::{
searchable::{Direction, SearchableItemHandle},
};
use workspace::{
Save, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace,
Save, Toast, Workspace,
item::{self, FollowableItem, Item, ItemHandle},
notifications::NotificationId,
pane,
Expand Down Expand Up @@ -2924,13 +2924,6 @@ impl FollowableItem for TextThreadEditor {
}
}

pub struct ContextEditorToolbarItem {
active_context_editor: Option<WeakEntity<TextThreadEditor>>,
model_summary_editor: Entity<Editor>,
}

impl ContextEditorToolbarItem {}

pub fn render_remaining_tokens(
context_editor: &Entity<TextThreadEditor>,
cx: &App,
Expand Down Expand Up @@ -2983,98 +2976,6 @@ pub fn render_remaining_tokens(
)
}

impl Render for ContextEditorToolbarItem {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let left_side = h_flex()
.group("chat-title-group")
.gap_1()
.items_center()
.flex_grow()
.child(
div()
.w_full()
.when(self.active_context_editor.is_some(), |left_side| {
left_side.child(self.model_summary_editor.clone())
}),
)
.child(
div().visible_on_hover("chat-title-group").child(
IconButton::new("regenerate-context", IconName::RefreshTitle)
.shape(ui::IconButtonShape::Square)
.tooltip(Tooltip::text("Regenerate Title"))
.on_click(cx.listener(move |_, _, _window, cx| {
cx.emit(ContextEditorToolbarItemEvent::RegenerateSummary)
})),
),
);

let right_side = h_flex()
.gap_2()
// TODO display this in a nicer way, once we have a design for it.
// .children({
// let project = self
// .workspace
// .upgrade()
// .map(|workspace| workspace.read(cx).project().downgrade());
//
// let scan_items_remaining = cx.update_global(|db: &mut SemanticDb, cx| {
// project.and_then(|project| db.remaining_summaries(&project, cx))
// });
// scan_items_remaining
// .map(|remaining_items| format!("Files to scan: {}", remaining_items))
// })
.children(
self.active_context_editor
.as_ref()
.and_then(|editor| editor.upgrade())
.and_then(|editor| render_remaining_tokens(&editor, cx)),
);

h_flex()
.px_0p5()
.size_full()
.gap_2()
.justify_between()
.child(left_side)
.child(right_side)
}
}

impl ToolbarItemView for ContextEditorToolbarItem {
fn set_active_pane_item(
&mut self,
active_pane_item: Option<&dyn ItemHandle>,
_window: &mut Window,
cx: &mut Context<Self>,
) -> ToolbarItemLocation {
self.active_context_editor = active_pane_item
.and_then(|item| item.act_as::<TextThreadEditor>(cx))
.map(|editor| editor.downgrade());
cx.notify();
if self.active_context_editor.is_none() {
ToolbarItemLocation::Hidden
} else {
ToolbarItemLocation::PrimaryRight
}
}

fn pane_focus_update(
&mut self,
_pane_focused: bool,
_window: &mut Window,
cx: &mut Context<Self>,
) {
cx.notify();
}
}

impl EventEmitter<ToolbarItemEvent> for ContextEditorToolbarItem {}

pub enum ContextEditorToolbarItemEvent {
RegenerateSummary,
}
impl EventEmitter<ContextEditorToolbarItemEvent> for ContextEditorToolbarItem {}

enum PendingSlashCommand {}

fn invoked_slash_command_fold_placeholder(
Expand Down
2 changes: 1 addition & 1 deletion crates/assistant_slash_commands/src/delta_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SlashCommand for DeltaSlashCommand {
.slice(section.range.to_offset(&context_buffer)),
);
file_command_new_outputs.push(Arc::new(FileSlashCommand).run(
&[metadata.path.clone()],
std::slice::from_ref(&metadata.path),
context_slash_command_output_sections,
context_buffer.clone(),
workspace.clone(),
Expand Down
2 changes: 1 addition & 1 deletion crates/buffer_diff/src/buffer_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ mod tests {
let hunk = diff.hunks(&buffer, cx).next().unwrap();

let new_index_text = diff
.stage_or_unstage_hunks(true, &[hunk.clone()], &buffer, true, cx)
.stage_or_unstage_hunks(true, std::slice::from_ref(&hunk), &buffer, true, cx)
.unwrap()
.to_string();
assert_eq!(new_index_text, buffer_text);
Expand Down
5 changes: 4 additions & 1 deletion crates/collab/src/db/tests/embedding_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ async fn test_purge_old_embeddings(cx: &mut gpui::TestAppContext) {
db.purge_old_embeddings().await.unwrap();

// Try to retrieve the purged embeddings
let retrieved_embeddings = db.get_embeddings(model, &[digest.clone()]).await.unwrap();
let retrieved_embeddings = db
.get_embeddings(model, std::slice::from_ref(&digest))
.await
.unwrap();
assert!(
retrieved_embeddings.is_empty(),
"Old embeddings should have been purged"
Expand Down
4 changes: 2 additions & 2 deletions crates/collab/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct Session {
}

impl Session {
async fn db(&self) -> tokio::sync::MutexGuard<DbHandle> {
async fn db(&self) -> tokio::sync::MutexGuard<'_, DbHandle> {
#[cfg(test)]
tokio::task::yield_now().await;
let guard = self.db.lock().await;
Expand Down Expand Up @@ -1037,7 +1037,7 @@ impl Server {
}
}

pub async fn snapshot(self: &Arc<Self>) -> ServerSnapshot {
pub async fn snapshot(self: &Arc<Self>) -> ServerSnapshot<'_> {
ServerSnapshot {
connection_pool: ConnectionPoolGuard {
guard: self.connection_pool.lock(),
Expand Down
13 changes: 10 additions & 3 deletions crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3897,8 +3897,10 @@ impl Editor {
bracket_pair_matching_end = Some(pair.clone());
}
}
if bracket_pair.is_none() && bracket_pair_matching_end.is_some() {
bracket_pair = Some(bracket_pair_matching_end.unwrap());
if let Some(end) = bracket_pair_matching_end
&& bracket_pair.is_none()
{
bracket_pair = Some(end);
is_bracket_pair_end = true;
}
}
Expand Down Expand Up @@ -13381,7 +13383,12 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Editor>,
) {
self.unfold_ranges(&[range.clone()], false, auto_scroll.is_some(), cx);
self.unfold_ranges(
std::slice::from_ref(&range),
false,
auto_scroll.is_some(),
cx,
);
self.change_selections(auto_scroll, window, cx, |s| {
if replace_newest {
s.delete(s.newest_anchor().id);
Expand Down
Loading