Do not show directories in the InvalidBufferView (#36906)

Follow-up of https://github.com/zed-industries/zed/pull/36764

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2025-08-25 21:16:37 +00:00
committed by GitHub
parent 628a9cd8ea
commit 65de969cc8
5 changed files with 50 additions and 86 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
use std::{path::PathBuf, sync::Arc};
use std::{path::Path, sync::Arc};
use gpui::{EventEmitter, FocusHandle, Focusable};
use ui::{
@@ -12,7 +12,7 @@ use crate::Item;
/// A view to display when a certain buffer fails to open.
pub struct InvalidBufferView {
/// Which path was attempted to open.
pub abs_path: Arc<PathBuf>,
pub abs_path: Arc<Path>,
/// An error message, happened when opening the buffer.
pub error: SharedString,
is_local: bool,
@@ -21,7 +21,7 @@ pub struct InvalidBufferView {
impl InvalidBufferView {
pub fn new(
abs_path: PathBuf,
abs_path: &Path,
is_local: bool,
e: &anyhow::Error,
_: &mut Window,
@@ -29,7 +29,7 @@ impl InvalidBufferView {
) -> Self {
Self {
is_local,
abs_path: Arc::new(abs_path),
abs_path: Arc::from(abs_path),
error: format!("{e}").into(),
focus_handle: cx.focus_handle(),
}
@@ -43,7 +43,7 @@ impl Item for InvalidBufferView {
// Ensure we always render at least the filename.
detail += 1;
let path = self.abs_path.as_path();
let path = self.abs_path.as_ref();
let mut prefix = path;
while detail > 0 {