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.

tabular_data_preview: Add shortcut to open tabular data preview (#63369)

Oleksandr Kholiavko7aa903ef25e4
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json
index 941c7f9b408..ec50d9e606a 100644
--- a/assets/keymaps/default-linux.json
+++ b/assets/keymaps/default-linux.json
@@ -615,6 +615,14 @@
"ctrl-shift-v": "svg::OpenPreview",
},
},
+ {
+ "context": "Editor && (extension == csv || extension == tsv || extension == ssv || extension == psv)",
+ "use_key_equivalents": true,
+ "bindings": {
+ "ctrl-k v": "tabular_data::OpenPreviewToTheSide",
+ "ctrl-shift-v": "tabular_data::OpenPreview",
+ },
+ },
{
"context": "Editor && mode == full",
"bindings": {
diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json
index c0ad8d1000e..bfee85b03af 100644
--- a/assets/keymaps/default-macos.json
+++ b/assets/keymaps/default-macos.json
@@ -653,6 +653,14 @@
"cmd-shift-v": "svg::OpenPreview",
},
},
+ {
+ "context": "Editor && (extension == csv || extension == tsv || extension == ssv || extension == psv)",
+ "use_key_equivalents": true,
+ "bindings": {
+ "cmd-k v": "tabular_data::OpenPreviewToTheSide",
+ "cmd-shift-v": "tabular_data::OpenPreview",
+ },
+ },
{
"context": "Editor && mode == full",
"use_key_equivalents": true,
diff --git a/assets/keymaps/default-windows.json b/assets/keymaps/default-windows.json
index e653fb3d58e..82d8c93124f 100644
--- a/assets/keymaps/default-windows.json
+++ b/assets/keymaps/default-windows.json
@@ -612,6 +612,14 @@
"ctrl-shift-v": "svg::OpenPreview",
},
},
+ {
+ "context": "Editor && (extension == csv || extension == tsv || extension == ssv || extension == psv)",
+ "use_key_equivalents": true,
+ "bindings": {
+ "ctrl-k v": "tabular_data::OpenPreviewToTheSide",
+ "ctrl-shift-v": "tabular_data::OpenPreview",
+ },
+ },
{
"context": "Editor && mode == full",
"use_key_equivalents": true,
diff --git a/crates/tabular_data_preview/src/tabular_data_preview.rs b/crates/tabular_data_preview/src/tabular_data_preview.rs
index 63b81692b9e..df84a119be0 100644
--- a/crates/tabular_data_preview/src/tabular_data_preview.rs
+++ b/crates/tabular_data_preview/src/tabular_data_preview.rs
@@ -120,7 +120,8 @@ impl TabularDataPreviewPane {
cx: &mut Context<Workspace>,
) {
let target_pane = workspace.adjacent_pane_of(&origin_pane, window, cx);
- Self::activate_or_add_preview(editor, target_pane, false, window, cx);
+ Self::activate_or_add_preview(editor.clone(), target_pane, false, window, cx);
+ editor.focus_handle(cx).focus(window, cx);
}
fn activate_or_add_preview(