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

@ -7559,6 +7559,24 @@ impl Project {
}
}
pub fn completions_for_open_path_query(
&self,
query: String,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<PathBuf>>> {
let fs = self.fs.clone();
cx.background_executor().spawn(async move {
let mut results = vec![];
let expanded = shellexpand::tilde(&query);
let query = Path::new(expanded.as_ref());
let mut response = fs.read_dir(query).await?;
while let Some(path) = response.next().await {
results.push(path?);
}
Ok(results)
})
}
fn create_local_worktree(
&mut self,
abs_path: impl AsRef<Path>,