Allow dragging files and tabs into the agent panel (#29959)

Release Notes:

- Added the ability to drag files and tabs onto the new agent panel.

---------

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
This commit is contained in:
Max Brunsfeld
2025-05-06 00:21:22 +00:00
committed by GitHub
co-authored by Michael Sloan
parent b214c9e4a8
commit 275c808b03
4 changed files with 181 additions and 68 deletions
+3 -16
View File
@@ -34,7 +34,7 @@ use smol::stream::StreamExt;
use std::ops::Range;
use std::path::Path;
use std::{ops::ControlFlow, path::PathBuf, sync::Arc};
use std::{ops::ControlFlow, sync::Arc};
use terminal_view::{TerminalView, terminal_panel::TerminalPanel};
use ui::{ContextMenu, PopoverMenu, Tooltip, prelude::*};
use util::{ResultExt, maybe};
@@ -54,7 +54,7 @@ pub fn init(cx: &mut App) {
.register_action(ContextEditor::quote_selection)
.register_action(ContextEditor::insert_selection)
.register_action(ContextEditor::copy_code)
.register_action(ContextEditor::insert_dragged_files)
.register_action(ContextEditor::handle_insert_dragged_files)
.register_action(AssistantPanel::show_configuration)
.register_action(AssistantPanel::create_new_context)
.register_action(AssistantPanel::restart_context_servers)
@@ -182,20 +182,7 @@ impl AssistantPanel {
None
}?;
let paths = project_paths
.into_iter()
.filter_map(|project_path| {
let worktree = project
.read(cx)
.worktree_for_id(project_path.worktree_id, cx)?;
let mut full_path = PathBuf::from(worktree.read(cx).root_name());
full_path.push(&project_path.path);
Some(full_path)
})
.collect::<Vec<_>>();
Some(InsertDraggedFiles::ProjectPaths(paths))
Some(InsertDraggedFiles::ProjectPaths(project_paths))
});
if let Some(action) = action {