open picker (#14524)

Release Notes:

- linux: Added a fallback Open picker for when XDG is not working
- Added a new setting `use_system_path_prompts` (default true) that can
be disabled to use Zed's builtin keyboard-driven prompts.

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Conrad Irwin 2024-07-15 17:04:15 -06:00 committed by GitHub
parent da33aac156
commit abc5abcd8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 453 additions and 69 deletions

View file

@ -462,7 +462,7 @@ impl PickerDelegate for TasksModalDelegate {
)
}
fn selected_as_query(&self) -> Option<String> {
fn confirm_completion(&self, _: String) -> Option<String> {
let task_index = self.matches.get(self.selected_index())?.candidate_id;
let tasks = self.candidates.as_ref()?;
let (_, task) = tasks.get(task_index)?;
@ -491,11 +491,7 @@ impl PickerDelegate for TasksModalDelegate {
fn render_footer(&self, cx: &mut ViewContext<Picker<Self>>) -> Option<gpui::AnyElement> {
let is_recent_selected = self.divider_index >= Some(self.selected_index);
let current_modifiers = cx.modifiers();
let left_button = if is_recent_selected {
Some(("Edit task", picker::UseSelectedQuery.boxed_clone()))
} else if !self.matches.is_empty() {
Some(("Edit template", picker::UseSelectedQuery.boxed_clone()))
} else if self
let left_button = if self
.project
.read(cx)
.task_inventory()
@ -663,7 +659,7 @@ mod tests {
"Only one task should match the query {query_str}"
);
cx.dispatch_action(picker::UseSelectedQuery);
cx.dispatch_action(picker::ConfirmCompletion);
assert_eq!(
query(&tasks_picker, cx),
"echo 4",
@ -710,7 +706,7 @@ mod tests {
"Last recently used one show task should be listed first"
);
cx.dispatch_action(picker::UseSelectedQuery);
cx.dispatch_action(picker::ConfirmCompletion);
assert_eq!(
query(&tasks_picker, cx),
query_str,