Fix more bugs in files (#16241)

Fixes:
- [x] an issue where directories would only match by prefix, causing
both a directory and a file to be matched if in the same directory
- [x] An issue where you could not continue a file completion when
selecting a directory, as `tab` on a file would always run the command.
This effectively disabled directory sub queries.
- [x] Inconsistent rendering of files and directories in the slash
command

Release Notes:

- N/A

---------

Co-authored-by: max <max@zed.dev>
This commit is contained in:
Mikayla Maki
2024-08-16 10:09:38 -07:00
committed by GitHub
co-authored by max
parent a3a6ebcf31
commit 455850505f
13 changed files with 415 additions and 47 deletions
@@ -181,7 +181,7 @@ impl SlashCommand for DocsSlashCommand {
.map(|item| ArgumentCompletion {
label: item.clone().into(),
new_text: item.to_string(),
run_command: true,
after_completion: assistant_slash_command::AfterCompletion::Run,
replace_previous_arguments: false,
})
.collect()
@@ -194,7 +194,7 @@ impl SlashCommand for DocsSlashCommand {
return Ok(vec![ArgumentCompletion {
label: "No available docs providers.".into(),
new_text: String::new(),
run_command: false,
after_completion: false.into(),
replace_previous_arguments: false,
}]);
}
@@ -204,7 +204,7 @@ impl SlashCommand for DocsSlashCommand {
.map(|provider| ArgumentCompletion {
label: provider.to_string().into(),
new_text: provider.to_string(),
run_command: false,
after_completion: false.into(),
replace_previous_arguments: false,
})
.collect())
@@ -236,7 +236,7 @@ impl SlashCommand for DocsSlashCommand {
.map(|package_name| ArgumentCompletion {
label: format!("{package_name} (unindexed)").into(),
new_text: format!("{package_name}"),
run_command: true,
after_completion: true.into(),
replace_previous_arguments: false,
})
.collect::<Vec<_>>();
@@ -250,7 +250,7 @@ impl SlashCommand for DocsSlashCommand {
)
.into(),
new_text: provider.to_string(),
run_command: false,
after_completion: false.into(),
replace_previous_arguments: false,
}]);
}