From 41994452f2726be1912fd1d7df7de26ffdce479d Mon Sep 17 00:00:00 2001 From: Andrew Farkas <6060305+HactarCE@users.noreply.github.com> Date: Sat, 18 Oct 2025 10:57:59 -0400 Subject: [PATCH] Fix `extension` keymap context for single file worktree (#40425) Closes #40353 Release Notes: - Fixed `extension` in keymap context being empty for single file worktree Co-authored-by: Cole Miller --- crates/editor/src/editor.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index cc02740900770e4bee42ad49361f65b7dda98568..2ff8b585c3f228f70246947bed8c2e6da221bd37 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");