zed/crates/zed_actions/src/lib.rs
Kirill Bulatov 1a2a538366
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Improve Linux terminal keymap and context menu (#16845)
Follow-up https://github.com/zed-industries/zed/pull/16085 that fixes
the search deploy to be actually a part of the terminal-related
bindings.

Part of https://github.com/zed-industries/zed/issues/16839

Also 

* fixes few other bindings to use `shift` and avoid conflicts with the
existing key bindings.
* adds terminal inline assist to the context menu and makes both the
menu and the button to dynamically adjust to `assist.enabled` settings
change

It is still unclear to me, why certain labels for certain bindings are
wrong (it's still showing `ctrl-w` for closing the terminal tab, and
`shift-insert` instead of `ctrl-shift-v` for Paste, while Insert is near
and has a `ctrl-shift-c` binding shown) but at least the keys work now.

Release notes: 
- Improved Linux terminal keymap and context menu
2024-08-26 01:01:46 +03:00

49 lines
1.1 KiB
Rust

use gpui::{actions, impl_actions};
use serde::Deserialize;
// If the zed binary doesn't use anything in this crate, it will be optimized away
// and the actions won't initialize. So we just provide an empty initialization function
// to be called from main.
//
// These may provide relevant context:
// https://github.com/rust-lang/rust/issues/47384
// https://github.com/mmastrac/rust-ctor/issues/280
pub fn init() {}
#[derive(Clone, PartialEq, Deserialize)]
pub struct OpenBrowser {
pub url: String,
}
#[derive(Clone, PartialEq, Deserialize)]
pub struct OpenZedUrl {
pub url: String,
}
impl_actions!(zed, [OpenBrowser, OpenZedUrl]);
actions!(
zed,
[
OpenSettings,
OpenAccountSettings,
Quit,
OpenKeymap,
About,
OpenLicenses,
OpenTelemetryLog,
DecreaseBufferFontSize,
IncreaseBufferFontSize,
ResetBufferFontSize,
DecreaseUiFontSize,
IncreaseUiFontSize,
ResetUiFontSize
]
);
#[derive(Clone, Default, Deserialize, PartialEq)]
pub struct InlineAssist {
pub prompt: Option<String>,
}
impl_actions!(assistant, [InlineAssist]);