Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix file extension retrieval for single-file worktrees

Max Brunsfeld55d3c09b6b51
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index dd5934f9794..426215eb15a 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -73,6 +73,7 @@ use std::{
mem,
num::NonZeroU32,
ops::{Deref, DerefMut, Range, RangeInclusive},
+ path::Path,
sync::Arc,
time::{Duration, Instant},
};
@@ -6536,15 +6537,13 @@ impl Editor {
.as_singleton()
.and_then(|b| b.read(cx).file()),
) {
- project.read(cx).client().report_event(
- name,
- json!({
- "File Extension": file
- .path()
- .extension()
- .and_then(|e| e.to_str())
- }),
- );
+ let extension = Path::new(file.file_name(cx))
+ .extension()
+ .and_then(|e| e.to_str());
+ project
+ .read(cx)
+ .client()
+ .report_event(name, json!({ "File Extension": extension }));
}
}
}