Add command aliases (#14826)
Co-Authored-By: <tobbe@tlundberg.com> Release Notes: - Added `"command_aliases"` setting to let you abbreviate commands
This commit is contained in:
parent
b22718e643
commit
1dc4d4200f
5 changed files with 47 additions and 3 deletions
|
@ -17,9 +17,10 @@ use gpui::{
|
|||
use picker::{Picker, PickerDelegate};
|
||||
|
||||
use postage::{sink::Sink, stream::Stream};
|
||||
use settings::Settings;
|
||||
use ui::{h_flex, prelude::*, v_flex, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing};
|
||||
use util::ResultExt;
|
||||
use workspace::{ModalView, Workspace};
|
||||
use workspace::{ModalView, Workspace, WorkspaceSettings};
|
||||
use zed_actions::OpenZedUrl;
|
||||
|
||||
actions!(command_palette, [Toggle]);
|
||||
|
@ -248,9 +249,13 @@ impl PickerDelegate for CommandPaletteDelegate {
|
|||
|
||||
fn update_matches(
|
||||
&mut self,
|
||||
query: String,
|
||||
mut query: String,
|
||||
cx: &mut ViewContext<Picker<Self>>,
|
||||
) -> gpui::Task<()> {
|
||||
let settings = WorkspaceSettings::get_global(cx);
|
||||
if let Some(alias) = settings.command_aliases.get(&query) {
|
||||
query = alias.to_string();
|
||||
}
|
||||
let (mut tx, mut rx) = postage::dispatch::channel(1);
|
||||
let task = cx.background_executor().spawn({
|
||||
let mut commands = self.all_commands.clone();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue