Merge branch 'main' into import-theme

This commit is contained in:
Marshall Bowers 2023-11-03 15:41:12 -04:00
commit 12500364b4
69 changed files with 46800 additions and 1132 deletions

View file

@ -34,7 +34,7 @@ copilot = { package = "copilot2", path = "../copilot2" }
# copilot_button = { path = "../copilot_button" }
# diagnostics = { path = "../diagnostics" }
db = { package = "db2", path = "../db2" }
# editor = { path = "../editor" }
editor = { package="editor2", path = "../editor2" }
# feedback = { path = "../feedback" }
# file_finder = { path = "../file_finder" }
# search = { path = "../search" }
@ -70,7 +70,7 @@ theme = { package = "theme2", path = "../theme2" }
util = { path = "../util" }
# semantic_index = { path = "../semantic_index" }
# vim = { path = "../vim" }
workspace2 = { path = "../workspace2" }
workspace = { package = "workspace2", path = "../workspace2" }
# welcome = { path = "../welcome" }
# zed-actions = {path = "../zed-actions"}
anyhow.workspace = true

View file

@ -4,18 +4,13 @@
// Allow binary to be called Zed for a nice application menu when running executable directly
#![allow(non_snake_case)]
use crate::open_listener::{OpenListener, OpenRequest};
use anyhow::{anyhow, Context as _, Result};
use backtrace::Backtrace;
use cli::{
ipc::{self, IpcSender},
CliRequest, CliResponse, IpcHandshake, FORCE_CLI_MODE_ENV_VAR_NAME,
};
use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
use client::UserStore;
use collections::HashMap;
use db::kvp::KEY_VALUE_STORE;
use fs::RealFs;
use futures::{channel::mpsc, SinkExt, StreamExt};
use futures::StreamExt;
use gpui::{Action, App, AppContext, AsyncAppContext, Context, SemanticVersion, Task};
use isahc::{prelude::Configurable, Request};
use language::LanguageRegistry;
@ -35,7 +30,7 @@ use std::{
fs::OpenOptions,
io::{IsTerminal, Write},
panic,
path::Path,
path::{Path, PathBuf},
sync::{
atomic::{AtomicU32, Ordering},
Arc,
@ -43,18 +38,18 @@ use std::{
thread,
time::{SystemTime, UNIX_EPOCH},
};
use text::Point;
use util::{
async_maybe,
channel::{parse_zed_link, ReleaseChannel, RELEASE_CHANNEL},
http::{self, HttpClient},
paths::{self, PathLikeWithPosition},
ResultExt,
paths, ResultExt,
};
use uuid::Uuid;
use workspace2::{AppState, WorkspaceStore};
use zed2::{build_window_options, initialize_workspace, languages};
use zed2::{ensure_only_instance, Assets, IsOnlyInstance};
use workspace::{AppState, WorkspaceStore};
use zed2::{
build_window_options, ensure_only_instance, handle_cli_connection, initialize_workspace,
languages, Assets, IsOnlyInstance, OpenListener, OpenRequest,
};
mod open_listener;
@ -143,7 +138,7 @@ fn main() {
client::init(&client, cx);
// command_palette::init(cx);
language::init(cx);
// editor::init(cx);
editor::init(cx);
// go_to_line::init(cx);
// file_finder::init(cx);
// outline::init(cx);
@ -194,7 +189,7 @@ fn main() {
// audio::init(Assets, cx);
// auto_update::init(http.clone(), client::ZED_SERVER_URL.clone(), cx);
workspace2::init(app_state.clone(), cx);
workspace::init(app_state.clone(), cx);
// recent_projects::init(cx);
// journal2::init(app_state.clone(), cx);
@ -213,6 +208,7 @@ fn main() {
if stdout_is_a_pty() {
cx.activate(true);
let urls = collect_url_args();
dbg!(&urls);
if !urls.is_empty() {
listener.open_urls(urls)
}
@ -230,9 +226,27 @@ fn main() {
let mut _triggered_authentication = false;
fn open_paths_and_log_errs(
paths: &[PathBuf],
app_state: &Arc<AppState>,
cx: &mut AppContext,
) {
let task = workspace::open_paths(&paths, &app_state, None, cx);
cx.spawn(|cx| async move {
if let Some((_window, results)) = task.await.log_err() {
for result in results {
if let Some(Err(e)) = result {
log::error!("Error opening path: {}", e);
}
}
}
})
.detach();
}
match open_rx.try_next() {
Ok(Some(OpenRequest::Paths { paths })) => {
workspace2::open_paths(&paths, &app_state, None, cx).detach();
open_paths_and_log_errs(&paths, &app_state, cx)
}
Ok(Some(OpenRequest::CliConnection { connection })) => {
let app_state = app_state.clone();
@ -240,6 +254,7 @@ fn main() {
.detach();
}
Ok(Some(OpenRequest::JoinChannel { channel_id: _ })) => {
todo!()
// triggered_authentication = true;
// let app_state = app_state.clone();
// let client = client.clone();
@ -251,6 +266,9 @@ fn main() {
// })
// .detach_and_log_err(cx)
}
Ok(Some(OpenRequest::OpenChannelNotes { channel_id: _ })) => {
todo!()
}
Ok(None) | Err(_) => cx
.spawn({
let app_state = app_state.clone();
@ -260,29 +278,25 @@ fn main() {
}
let app_state = app_state.clone();
cx.spawn(|cx| {
async move {
while let Some(request) = open_rx.next().await {
match request {
OpenRequest::Paths { paths } => {
cx.update(|cx| workspace2::open_paths(&paths, &app_state, None, cx))
.ok()
.map(|t| t.detach());
}
OpenRequest::CliConnection { connection } => {
let app_state = app_state.clone();
cx.spawn(move |cx| {
handle_cli_connection(connection, app_state.clone(), cx)
})
.detach();
}
OpenRequest::JoinChannel { channel_id: _ } => {
// cx
// .update(|cx| {
// workspace::join_channel(channel_id, app_state.clone(), None, cx)
// })
// .detach()
}
cx.spawn(|cx| async move {
while let Some(request) = open_rx.next().await {
match request {
OpenRequest::Paths { paths } => {
cx.update(|cx| open_paths_and_log_errs(&paths, &app_state, cx))
.ok();
}
OpenRequest::CliConnection { connection } => {
let app_state = app_state.clone();
cx.spawn(move |cx| {
handle_cli_connection(connection, app_state.clone(), cx)
})
.detach();
}
OpenRequest::JoinChannel { channel_id: _ } => {
todo!()
}
OpenRequest::OpenChannelNotes { channel_id: _ } => {
todo!()
}
}
}
@ -325,8 +339,8 @@ async fn installation_id() -> Result<String> {
async fn restore_or_create_workspace(app_state: &Arc<AppState>, mut cx: AsyncAppContext) {
async_maybe!({
if let Some(location) = workspace2::last_opened_workspace_paths().await {
cx.update(|cx| workspace2::open_paths(location.paths().as_ref(), app_state, None, cx))?
if let Some(location) = workspace::last_opened_workspace_paths().await {
cx.update(|cx| workspace::open_paths(location.paths().as_ref(), app_state, None, cx))?
.await
.log_err();
} else if matches!(KEY_VALUE_STORE.read_kvp("******* THIS IS A BAD KEY PLEASE UNCOMMENT BELOW TO FIX THIS VERY LONG LINE *******"), Ok(None)) {
@ -336,7 +350,7 @@ async fn restore_or_create_workspace(app_state: &Arc<AppState>, mut cx: AsyncApp
// cx.update(|cx| show_welcome_experience(app_state, cx));
} else {
cx.update(|cx| {
workspace2::open_new(app_state, cx, |workspace, cx| {
workspace::open_new(app_state, cx, |workspace, cx| {
// todo!(editor)
// Editor::new_file(workspace, &Default::default(), cx)
})
@ -746,190 +760,6 @@ fn load_embedded_fonts(cx: &AppContext) {
// #[cfg(not(debug_assertions))]
// fn watch_file_types(_fs: Arc<dyn Fs>, _cx: &mut AppContext) {}
fn connect_to_cli(
server_name: &str,
) -> Result<(mpsc::Receiver<CliRequest>, IpcSender<CliResponse>)> {
let handshake_tx = cli::ipc::IpcSender::<IpcHandshake>::connect(server_name.to_string())
.context("error connecting to cli")?;
let (request_tx, request_rx) = ipc::channel::<CliRequest>()?;
let (response_tx, response_rx) = ipc::channel::<CliResponse>()?;
handshake_tx
.send(IpcHandshake {
requests: request_tx,
responses: response_rx,
})
.context("error sending ipc handshake")?;
let (mut async_request_tx, async_request_rx) =
futures::channel::mpsc::channel::<CliRequest>(16);
thread::spawn(move || {
while let Ok(cli_request) = request_rx.recv() {
if smol::block_on(async_request_tx.send(cli_request)).is_err() {
break;
}
}
Ok::<_, anyhow::Error>(())
});
Ok((async_request_rx, response_tx))
}
async fn handle_cli_connection(
(mut requests, _responses): (mpsc::Receiver<CliRequest>, IpcSender<CliResponse>),
_app_state: Arc<AppState>,
mut _cx: AsyncAppContext,
) {
if let Some(request) = requests.next().await {
match request {
CliRequest::Open { paths, wait } => {
let mut caret_positions = HashMap::default();
let paths = if paths.is_empty() {
workspace2::last_opened_workspace_paths()
.await
.map(|location| location.paths().to_vec())
.unwrap_or_default()
} else {
paths
.into_iter()
.filter_map(|path_with_position_string| {
let path_with_position = PathLikeWithPosition::parse_str(
&path_with_position_string,
|path_str| {
Ok::<_, std::convert::Infallible>(
Path::new(path_str).to_path_buf(),
)
},
)
.expect("Infallible");
let path = path_with_position.path_like;
if let Some(row) = path_with_position.row {
if path.is_file() {
let row = row.saturating_sub(1);
let col =
path_with_position.column.unwrap_or(0).saturating_sub(1);
caret_positions.insert(path.clone(), Point::new(row, col));
}
}
Some(path)
})
.collect()
};
// todo!("editor")
// let mut errored = false;
// match cx
// .update(|cx| workspace2::open_paths(&paths, &app_state, None, cx))
// .await
// {
// Ok((workspace, items)) => {
// let mut item_release_futures = Vec::new();
// for (item, path) in items.into_iter().zip(&paths) {
// match item {
// Some(Ok(item)) => {
// if let Some(point) = caret_positions.remove(path) {
// if let Some(active_editor) = item.downcast::<Editor>() {
// active_editor
// .downgrade()
// .update(&mut cx, |editor, cx| {
// let snapshot =
// editor.snapshot(cx).display_snapshot;
// let point = snapshot
// .buffer_snapshot
// .clip_point(point, Bias::Left);
// editor.change_selections(
// Some(Autoscroll::center()),
// cx,
// |s| s.select_ranges([point..point]),
// );
// })
// .log_err();
// }
// }
// let released = oneshot::channel();
// cx.update(|cx| {
// item.on_release(
// cx,
// Box::new(move |_| {
// let _ = released.0.send(());
// }),
// )
// .detach();
// });
// item_release_futures.push(released.1);
// }
// Some(Err(err)) => {
// responses
// .send(CliResponse::Stderr {
// message: format!("error opening {:?}: {}", path, err),
// })
// .log_err();
// errored = true;
// }
// None => {}
// }
// }
// if wait {
// let background = cx.background();
// let wait = async move {
// if paths.is_empty() {
// let (done_tx, done_rx) = oneshot::channel();
// if let Some(workspace) = workspace.upgrade(&cx) {
// let _subscription = cx.update(|cx| {
// cx.observe_release(&workspace, move |_, _| {
// let _ = done_tx.send(());
// })
// });
// drop(workspace);
// let _ = done_rx.await;
// }
// } else {
// let _ =
// futures::future::try_join_all(item_release_futures).await;
// };
// }
// .fuse();
// futures::pin_mut!(wait);
// loop {
// // Repeatedly check if CLI is still open to avoid wasting resources
// // waiting for files or workspaces to close.
// let mut timer = background.timer(Duration::from_secs(1)).fuse();
// futures::select_biased! {
// _ = wait => break,
// _ = timer => {
// if responses.send(CliResponse::Ping).is_err() {
// break;
// }
// }
// }
// }
// }
// }
// Err(error) => {
// errored = true;
// responses
// .send(CliResponse::Stderr {
// message: format!("error opening {:?}: {}", paths, error),
// })
// .log_err();
// }
// }
// responses
// .send(CliResponse::Exit {
// status: i32::from(errored),
// })
// .log_err();
}
}
}
}
pub fn background_actions() -> &'static [(&'static str, &'static dyn Action)] {
// &[
// ("Go to file", &file_finder::Toggle),

View file

@ -1,15 +1,26 @@
use anyhow::anyhow;
use anyhow::{anyhow, Context, Result};
use cli::{ipc, IpcHandshake};
use cli::{ipc::IpcSender, CliRequest, CliResponse};
use futures::channel::mpsc;
use editor::scroll::autoscroll::Autoscroll;
use editor::Editor;
use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
use futures::channel::{mpsc, oneshot};
use futures::{FutureExt, SinkExt, StreamExt};
use gpui::AsyncAppContext;
use language::{Bias, Point};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::os::unix::prelude::OsStrExt;
use std::path::Path;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::thread;
use std::time::Duration;
use std::{path::PathBuf, sync::atomic::AtomicBool};
use util::channel::parse_zed_link;
use util::paths::PathLikeWithPosition;
use util::ResultExt;
use crate::connect_to_cli;
use workspace::AppState;
pub enum OpenRequest {
Paths {
@ -21,6 +32,9 @@ pub enum OpenRequest {
JoinChannel {
channel_id: u64,
},
OpenChannelNotes {
channel_id: u64,
},
}
pub struct OpenListener {
@ -74,7 +88,11 @@ impl OpenListener {
if let Some(slug) = parts.next() {
if let Some(id_str) = slug.split("-").last() {
if let Ok(channel_id) = id_str.parse::<u64>() {
return Some(OpenRequest::JoinChannel { channel_id });
if Some("notes") == parts.next() {
return Some(OpenRequest::OpenChannelNotes { channel_id });
} else {
return Some(OpenRequest::JoinChannel { channel_id });
}
}
}
}
@ -96,3 +114,191 @@ impl OpenListener {
Some(OpenRequest::Paths { paths })
}
}
fn connect_to_cli(
server_name: &str,
) -> Result<(mpsc::Receiver<CliRequest>, IpcSender<CliResponse>)> {
let handshake_tx = cli::ipc::IpcSender::<IpcHandshake>::connect(server_name.to_string())
.context("error connecting to cli")?;
let (request_tx, request_rx) = ipc::channel::<CliRequest>()?;
let (response_tx, response_rx) = ipc::channel::<CliResponse>()?;
handshake_tx
.send(IpcHandshake {
requests: request_tx,
responses: response_rx,
})
.context("error sending ipc handshake")?;
let (mut async_request_tx, async_request_rx) =
futures::channel::mpsc::channel::<CliRequest>(16);
thread::spawn(move || {
while let Ok(cli_request) = request_rx.recv() {
if smol::block_on(async_request_tx.send(cli_request)).is_err() {
break;
}
}
Ok::<_, anyhow::Error>(())
});
Ok((async_request_rx, response_tx))
}
pub async fn handle_cli_connection(
(mut requests, responses): (mpsc::Receiver<CliRequest>, IpcSender<CliResponse>),
app_state: Arc<AppState>,
mut cx: AsyncAppContext,
) {
if let Some(request) = requests.next().await {
match request {
CliRequest::Open { paths, wait } => {
let mut caret_positions = HashMap::new();
let paths = if paths.is_empty() {
workspace::last_opened_workspace_paths()
.await
.map(|location| location.paths().to_vec())
.unwrap_or_default()
} else {
paths
.into_iter()
.filter_map(|path_with_position_string| {
let path_with_position = PathLikeWithPosition::parse_str(
&path_with_position_string,
|path_str| {
Ok::<_, std::convert::Infallible>(
Path::new(path_str).to_path_buf(),
)
},
)
.expect("Infallible");
let path = path_with_position.path_like;
if let Some(row) = path_with_position.row {
if path.is_file() {
let row = row.saturating_sub(1);
let col =
path_with_position.column.unwrap_or(0).saturating_sub(1);
caret_positions.insert(path.clone(), Point::new(row, col));
}
}
Some(path)
})
.collect()
};
let mut errored = false;
match cx.update(|cx| workspace::open_paths(&paths, &app_state, None, cx)) {
Ok(task) => match task.await {
Ok((workspace, items)) => {
let mut item_release_futures = Vec::new();
for (item, path) in items.into_iter().zip(&paths) {
match item {
Some(Ok(item)) => {
if let Some(point) = caret_positions.remove(path) {
if let Some(active_editor) = item.downcast::<Editor>() {
workspace
.update(&mut cx, |_, cx| {
active_editor.update(cx, |editor, cx| {
let snapshot = editor
.snapshot(cx)
.display_snapshot;
let point = snapshot
.buffer_snapshot
.clip_point(point, Bias::Left);
editor.change_selections(
Some(Autoscroll::center()),
cx,
|s| s.select_ranges([point..point]),
);
});
})
.log_err();
}
}
cx.update(|cx| {
let released = oneshot::channel();
item.on_release(
cx,
Box::new(move |_| {
let _ = released.0.send(());
}),
)
.detach();
item_release_futures.push(released.1);
})
.log_err();
}
Some(Err(err)) => {
responses
.send(CliResponse::Stderr {
message: format!(
"error opening {:?}: {}",
path, err
),
})
.log_err();
errored = true;
}
None => {}
}
}
if wait {
let background = cx.background_executor().clone();
let wait = async move {
if paths.is_empty() {
let (done_tx, done_rx) = oneshot::channel();
let _subscription =
workspace.update(&mut cx, |workspace, cx| {
cx.on_release(move |_, _| {
let _ = done_tx.send(());
})
});
let _ = done_rx.await;
} else {
let _ = futures::future::try_join_all(item_release_futures)
.await;
};
}
.fuse();
futures::pin_mut!(wait);
loop {
// Repeatedly check if CLI is still open to avoid wasting resources
// waiting for files or workspaces to close.
let mut timer = background.timer(Duration::from_secs(1)).fuse();
futures::select_biased! {
_ = wait => break,
_ = timer => {
if responses.send(CliResponse::Ping).is_err() {
break;
}
}
}
}
}
}
Err(error) => {
errored = true;
responses
.send(CliResponse::Stderr {
message: format!("error opening {:?}: {}", paths, error),
})
.log_err();
}
},
Err(_) => errored = true,
}
responses
.send(CliResponse::Exit {
status: i32::from(errored),
})
.log_err();
}
}
}
}

View file

@ -7,216 +7,17 @@ mod only_instance;
mod open_listener;
pub use assets::*;
use collections::HashMap;
use gpui::{
point, px, AppContext, AsyncAppContext, AsyncWindowContext, Point, Task, TitlebarOptions,
WeakView, WindowBounds, WindowKind, WindowOptions,
point, px, AppContext, AsyncWindowContext, Task, TitlebarOptions, WeakView, WindowBounds,
WindowKind, WindowOptions,
};
pub use only_instance::*;
pub use open_listener::*;
use anyhow::{Context, Result};
use cli::{
ipc::{self, IpcSender},
CliRequest, CliResponse, IpcHandshake,
};
use futures::{
channel::{mpsc, oneshot},
FutureExt, SinkExt, StreamExt,
};
use std::{path::Path, sync::Arc, thread, time::Duration};
use util::{paths::PathLikeWithPosition, ResultExt};
use anyhow::Result;
use std::sync::Arc;
use uuid::Uuid;
use workspace2::{AppState, Workspace};
pub fn connect_to_cli(
server_name: &str,
) -> Result<(mpsc::Receiver<CliRequest>, IpcSender<CliResponse>)> {
let handshake_tx = cli::ipc::IpcSender::<IpcHandshake>::connect(server_name.to_string())
.context("error connecting to cli")?;
let (request_tx, request_rx) = ipc::channel::<CliRequest>()?;
let (response_tx, response_rx) = ipc::channel::<CliResponse>()?;
handshake_tx
.send(IpcHandshake {
requests: request_tx,
responses: response_rx,
})
.context("error sending ipc handshake")?;
let (mut async_request_tx, async_request_rx) =
futures::channel::mpsc::channel::<CliRequest>(16);
thread::spawn(move || {
while let Ok(cli_request) = request_rx.recv() {
if smol::block_on(async_request_tx.send(cli_request)).is_err() {
break;
}
}
Ok::<_, anyhow::Error>(())
});
Ok((async_request_rx, response_tx))
}
pub async fn handle_cli_connection(
(mut requests, responses): (mpsc::Receiver<CliRequest>, IpcSender<CliResponse>),
app_state: Arc<AppState>,
mut cx: AsyncAppContext,
) {
if let Some(request) = requests.next().await {
match request {
CliRequest::Open { paths, wait } => {
let mut caret_positions = HashMap::default();
let paths = if paths.is_empty() {
workspace2::last_opened_workspace_paths()
.await
.map(|location| location.paths().to_vec())
.unwrap_or_default()
} else {
paths
.into_iter()
.filter_map(|path_with_position_string| {
let path_with_position = PathLikeWithPosition::parse_str(
&path_with_position_string,
|path_str| {
Ok::<_, std::convert::Infallible>(
Path::new(path_str).to_path_buf(),
)
},
)
.expect("Infallible");
let path = path_with_position.path_like;
if let Some(row) = path_with_position.row {
if path.is_file() {
let row = row.saturating_sub(1);
let col =
path_with_position.column.unwrap_or(0).saturating_sub(1);
caret_positions.insert(path.clone(), Point::new(row, col));
}
}
Some(path)
})
.collect::<Vec<_>>()
};
let mut errored = false;
if let Some(open_paths_task) = cx
.update(|cx| workspace2::open_paths(&paths, &app_state, None, cx))
.log_err()
{
match open_paths_task.await {
Ok((workspace, items)) => {
let mut item_release_futures = Vec::new();
for (item, path) in items.into_iter().zip(&paths) {
match item {
Some(Ok(mut item)) => {
if let Some(point) = caret_positions.remove(path) {
todo!("editor")
// if let Some(active_editor) = item.downcast::<Editor>() {
// active_editor
// .downgrade()
// .update(&mut cx, |editor, cx| {
// let snapshot =
// editor.snapshot(cx).display_snapshot;
// let point = snapshot
// .buffer_snapshot
// .clip_point(point, Bias::Left);
// editor.change_selections(
// Some(Autoscroll::center()),
// cx,
// |s| s.select_ranges([point..point]),
// );
// })
// .log_err();
// }
}
let released = oneshot::channel();
cx.update(move |cx| {
item.on_release(
cx,
Box::new(move |_| {
let _ = released.0.send(());
}),
)
.detach();
})
.ok();
item_release_futures.push(released.1);
}
Some(Err(err)) => {
responses
.send(CliResponse::Stderr {
message: format!(
"error opening {:?}: {}",
path, err
),
})
.log_err();
errored = true;
}
None => {}
}
}
if wait {
let executor = cx.background_executor().clone();
let wait = async move {
if paths.is_empty() {
let (done_tx, done_rx) = oneshot::channel();
let _subscription =
workspace.update(&mut cx, move |_, cx| {
cx.on_release(|_, _| {
let _ = done_tx.send(());
})
});
let _ = done_rx.await;
} else {
let _ = futures::future::try_join_all(item_release_futures)
.await;
};
}
.fuse();
futures::pin_mut!(wait);
loop {
// Repeatedly check if CLI is still open to avoid wasting resources
// waiting for files or workspaces to close.
let mut timer = executor.timer(Duration::from_secs(1)).fuse();
futures::select_biased! {
_ = wait => break,
_ = timer => {
if responses.send(CliResponse::Ping).is_err() {
break;
}
}
}
}
}
}
Err(error) => {
errored = true;
responses
.send(CliResponse::Stderr {
message: format!("error opening {:?}: {}", paths, error),
})
.log_err();
}
}
responses
.send(CliResponse::Exit {
status: i32::from(errored),
})
.log_err();
}
}
}
}
}
use workspace::{AppState, Workspace};
pub fn build_window_options(
bounds: Option<WindowBounds>,
@ -257,7 +58,7 @@ pub fn initialize_workspace(
let workspace_handle = cx.view();
cx.subscribe(&workspace_handle, {
move |workspace, _, event, cx| {
if let workspace2::Event::PaneAdded(pane) = event {
if let workspace::Event::PaneAdded(pane) = event {
pane.update(cx, |pane, cx| {
pane.toolbar().update(cx, |toolbar, cx| {
// todo!()