assistant2: Suggest current file as context (#22526)

Suggest adding the current file as context in the new assistant panel.



https://github.com/user-attachments/assets/62bc267b-3dfe-4a3b-a6af-c89af2c779a8


Note: This doesn't include suggesting the current thread in the inline
assistant.

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-01-02 10:33:47 -03:00 committed by GitHub
parent b3e36c93b4
commit 59b5b9af90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 191 additions and 31 deletions

View file

@ -1,5 +1,6 @@
use gpui::SharedString;
use language_model::{LanguageModelRequestMessage, MessageContent};
use project::ProjectEntryId;
use serde::{Deserialize, Serialize};
use util::post_inc;
@ -23,7 +24,7 @@ pub struct Context {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ContextKind {
File,
File(ProjectEntryId),
Directory,
FetchedUrl,
Thread,
@ -40,7 +41,7 @@ pub fn attach_context_to_message(
for context in context.into_iter() {
match context.kind {
ContextKind::File => {
ContextKind::File(_) => {
file_context.push_str(&context.text);
file_context.push('\n');
}