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 <cole@zed.dev>
This commit is contained in:
co-authored by
Cole Miller
parent
89be2635d4
commit
41994452f2
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user