Checkpoint

This commit is contained in:
Antonio Scandurra
2023-11-02 11:05:24 +01:00
parent 72156bf502
commit 32dded551c
6 changed files with 325 additions and 325 deletions
+3 -6
View File
@@ -12,7 +12,7 @@ use client2::UserStore;
use db2::kvp::KEY_VALUE_STORE;
use fs2::RealFs;
use futures::{channel::mpsc, SinkExt, StreamExt};
use gpui2::{Action, App, AppContext, AsyncAppContext, Context, MainThread, SemanticVersion, Task};
use gpui2::{Action, App, AppContext, AsyncAppContext, Context, SemanticVersion, Task};
use isahc::{prelude::Configurable, Request};
use language2::LanguageRegistry;
use log::LevelFilter;
@@ -249,7 +249,7 @@ fn main() {
// .detach_and_log_err(cx)
}
Ok(None) | Err(_) => cx
.spawn_on_main({
.spawn({
let app_state = app_state.clone();
|cx| async move { restore_or_create_workspace(&app_state, cx).await }
})
@@ -320,10 +320,7 @@ async fn installation_id() -> Result<String> {
}
}
async fn restore_or_create_workspace(
app_state: &Arc<AppState>,
mut cx: MainThread<AsyncAppContext>,
) {
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))?
+9 -5
View File
@@ -6,8 +6,8 @@ mod open_listener;
pub use assets::*;
use collections::HashMap;
use gpui2::{
point, px, AppContext, AsyncAppContext, AsyncWindowContext, MainThread, Point, Task,
TitlebarOptions, WeakView, WindowBounds, WindowHandle, WindowKind, WindowOptions,
point, px, AppContext, AsyncAppContext, AsyncWindowContext, Point, Task, TitlebarOptions,
WeakView, WindowBounds, WindowKind, WindowOptions,
};
pub use only_instance::*;
pub use open_listener::*;
@@ -160,7 +160,7 @@ pub async fn handle_cli_connection(
}
if wait {
let executor = cx.executor().clone();
let executor = cx.background_executor().clone();
let wait = async move {
if paths.is_empty() {
let (done_tx, done_rx) = oneshot::channel();
@@ -219,10 +219,14 @@ pub async fn handle_cli_connection(
pub fn build_window_options(
bounds: Option<WindowBounds>,
display_uuid: Option<Uuid>,
cx: &mut MainThread<AppContext>,
cx: &mut AppContext,
) -> WindowOptions {
let bounds = bounds.unwrap_or(WindowBounds::Maximized);
let display = display_uuid.and_then(|uuid| cx.display_for_uuid(uuid));
let display = display_uuid.and_then(|uuid| {
cx.displays()
.into_iter()
.find(|display| display.uuid().ok() == Some(uuid))
});
WindowOptions {
bounds,