agent_ui: Auto-capture file context on paste (#42982)
Closes #42972 https://github.com/user-attachments/assets/98f2d3dc-5682-4670-b636-fa8ea2495c69 Release Notes: - Added automatic file context detection when pasting code into the AI agent panel. Pasted code now displays as collapsible badges showing the file path and line numbers (e.g., "app/layout.tsx (18-25)"). --------- Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
@@ -11,7 +11,6 @@ use editor::{ClipboardSelection, Editor, SelectionEffects};
|
||||
use gpui::Context;
|
||||
use gpui::Window;
|
||||
use language::Point;
|
||||
use multi_buffer::MultiBufferRow;
|
||||
use settings::Settings;
|
||||
|
||||
struct HighlightOnYank;
|
||||
@@ -198,11 +197,14 @@ impl Vim {
|
||||
if kind.linewise() {
|
||||
text.push('\n');
|
||||
}
|
||||
clipboard_selections.push(ClipboardSelection {
|
||||
len: text.len() - initial_len,
|
||||
is_entire_line: false,
|
||||
first_line_indent: buffer.indent_size_for_line(MultiBufferRow(start.row)).len,
|
||||
});
|
||||
clipboard_selections.push(ClipboardSelection::for_buffer(
|
||||
text.len() - initial_len,
|
||||
false,
|
||||
start..end,
|
||||
&buffer,
|
||||
editor.project(),
|
||||
cx,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user