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 `extension` keymap context for single file worktree (#40425)

Andrew Farkas41994452f272
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index cc027409007..2ff8b585c3f 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -2523,12 +2523,15 @@ impl Editor {
}
if let Some(singleton_buffer) = self.buffer.read(cx).as_singleton() {
- if let Some(extension) = singleton_buffer
- .read(cx)
- .file()
- .and_then(|file| file.path().extension())
- {
- key_context.set("extension", extension.to_string());
+ if let Some(extension) = singleton_buffer.read(cx).file().and_then(|file| {
+ Some(
+ file.full_path(cx)
+ .extension()?
+ .to_string_lossy()
+ .into_owned(),
+ )
+ }) {
+ key_context.set("extension", extension);
}
} else {
key_context.add("multibuffer");