mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Fix OpenPathPrompt locally with tilde (#17027)
Release Notes: - Fixed a panic opening a file in ~/ with `use_system_prompts: false`
This commit is contained in:
parent
9beb4d4380
commit
f19d0f0b98
@ -236,7 +236,12 @@ impl PickerDelegate for OpenPathDelegate {
|
||||
let Some(candidate) = directory_state.match_candidates.get(*m) else {
|
||||
return;
|
||||
};
|
||||
let result = Path::new(&directory_state.path).join(&candidate.string);
|
||||
let result = Path::new(
|
||||
self.lister
|
||||
.resolve_tilde(&directory_state.path, cx)
|
||||
.as_ref(),
|
||||
)
|
||||
.join(&candidate.string);
|
||||
if let Some(tx) = self.tx.take() {
|
||||
tx.send(Some(vec![result])).ok();
|
||||
}
|
||||
|
@ -664,6 +664,14 @@ impl DirectoryLister {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn resolve_tilde<'a>(&self, path: &'a String, cx: &AppContext) -> Cow<'a, str> {
|
||||
if self.is_local(cx) {
|
||||
shellexpand::tilde(path)
|
||||
} else {
|
||||
Cow::from(path)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_query(&self, cx: &mut AppContext) -> String {
|
||||
if let DirectoryLister::Project(project) = self {
|
||||
if let Some(worktree) = project.read(cx).visible_worktrees(cx).next() {
|
||||
|
Loading…
Reference in New Issue
Block a user