-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assistant2: Suggest current file as context #22526
Conversation
if self.workspace_active_pane_id != new_active_item_id { | ||
self.suggested_context = Self::suggested_file(active_item, cx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, workspace emits the ActiveItemChanged
event many times when the active item changes.
pub fn contains_project_entry(&self, entry_id: ProjectEntryId) -> bool { | ||
self.context.iter().any(|probe| match probe.kind { | ||
ContextKind::File(probe_entry_id) => probe_entry_id == entry_id, | ||
ContextKind::Directory => false, | ||
ContextKind::FetchedUrl => false, | ||
ContextKind::Thread => false, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the linear search should be ok for the current usage, but we may want to consider an alternative approach if we use this to filter file_context_picker
entries later.
Suggest adding the current file as context in the new assistant panel.
CleanShot.2024-12-31.at.19.11.24.mp4
Note: This doesn't include suggesting the current thread in the inline assistant.
Release Notes: