assistant: Add diagnostics slash command (#12998)

This adds a `diagnostics` command to the assistant which allows to
inject compile errors/warnings into the context.

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2024-06-14 17:14:50 +02:00 committed by GitHub
parent bf03f66d02
commit 0d8e6e6b12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 502 additions and 47 deletions

View file

@ -7337,7 +7337,7 @@ impl Project {
if query.include_ignored() {
for (snapshot, settings) in snapshots {
for ignored_entry in snapshot.entries(true).filter(|e| e.is_ignored) {
for ignored_entry in snapshot.entries(true, 0).filter(|e| e.is_ignored) {
let limiter = Arc::clone(&max_concurrent_workers);
scope.spawn(async move {
let _guard = limiter.acquire().await;
@ -11397,7 +11397,16 @@ pub struct PathMatchCandidateSet {
pub snapshot: Snapshot,
pub include_ignored: bool,
pub include_root_name: bool,
pub directories_only: bool,
pub candidates: Candidates,
}
pub enum Candidates {
/// Only consider directories.
Directories,
/// Only consider files.
Files,
/// Consider directories and files.
Entries,
}
impl<'a> fuzzy::PathMatchCandidateSet<'a> for PathMatchCandidateSet {
@ -11427,10 +11436,10 @@ impl<'a> fuzzy::PathMatchCandidateSet<'a> for PathMatchCandidateSet {
fn candidates(&'a self, start: usize) -> Self::Candidates {
PathMatchCandidateSetIter {
traversal: if self.directories_only {
self.snapshot.directories(self.include_ignored, start)
} else {
self.snapshot.files(self.include_ignored, start)
traversal: match self.candidates {
Candidates::Directories => self.snapshot.directories(self.include_ignored, start),
Candidates::Files => self.snapshot.files(self.include_ignored, start),
Candidates::Entries => self.snapshot.entries(self.include_ignored, start),
},
}
}

View file

@ -765,7 +765,7 @@ async fn test_reporting_fs_changes_to_language_servers(cx: &mut gpui::TestAppCon
worktree
.read(cx)
.snapshot()
.entries(true)
.entries(true, 0)
.map(|entry| (entry.path.as_ref(), entry.is_ignored))
.collect::<Vec<_>>(),
&[
@ -839,7 +839,7 @@ async fn test_reporting_fs_changes_to_language_servers(cx: &mut gpui::TestAppCon
worktree
.read(cx)
.snapshot()
.entries(true)
.entries(true, 0)
.map(|entry| (entry.path.as_ref(), entry.is_ignored))
.collect::<Vec<_>>(),
&[