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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user