Add call2

Co-Authored-By: Kirill Bulatov <kirill@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Antonio Scandurra
2023-10-26 11:56:34 +02:00
co-authored by Kirill Bulatov Mikayla Maki
parent 483ac9491a
commit 3bcae6d7de
9 changed files with 67 additions and 45 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ path = "src/main.rs"
# activity_indicator = { path = "../activity_indicator" }
# auto_update = { path = "../auto_update" }
# breadcrumbs = { path = "../breadcrumbs" }
# call = { path = "../call" }
call2 = { path = "../call2" }
# channel = { path = "../channel" }
cli = { path = "../cli" }
# collab_ui = { path = "../collab_ui" }
@@ -52,7 +52,7 @@ node_runtime = { path = "../node_runtime" }
# assistant = { path = "../assistant" }
# outline = { path = "../outline" }
# plugin_runtime = { path = "../plugin_runtime",optional = true }
# project = { path = "../project" }
project2 = { path = "../project2" }
# project_panel = { path = "../project_panel" }
# project_symbols = { path = "../project_symbols" }
# quick_action_bar = { path = "../quick_action_bar" }
@@ -140,14 +140,14 @@ urlencoding = "2.1.2"
uuid.workspace = true
[dev-dependencies]
# call = { path = "../call", features = ["test-support"] }
call2 = { path = "../call2", features = ["test-support"] }
# client = { path = "../client", features = ["test-support"] }
# editor = { path = "../editor", features = ["test-support"] }
# gpui = { path = "../gpui", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] }
# language = { path = "../language", features = ["test-support"] }
language2 = { path = "../language2", features = ["test-support"] }
# lsp = { path = "../lsp", features = ["test-support"] }
# project = { path = "../project", features = ["test-support"] }
project2 = { path = "../project2", features = ["test-support"] }
# rpc = { path = "../rpc", features = ["test-support"] }
# settings = { path = "../settings", features = ["test-support"] }
# text = { path = "../text", features = ["test-support"] }
+6 -5
View File
@@ -2,16 +2,17 @@
#![allow(non_snake_case)]
use crate::open_listener::{OpenListener, OpenRequest};
use anyhow::{anyhow, Context, Result};
use anyhow::{anyhow, Context as _, Result};
use backtrace::Backtrace;
use cli::{
ipc::{self, IpcSender},
CliRequest, CliResponse, IpcHandshake, FORCE_CLI_MODE_ENV_VAR_NAME,
};
use client2::UserStore;
use db2::kvp::KEY_VALUE_STORE;
use fs::RealFs;
use futures::{channel::mpsc, SinkExt, StreamExt};
use gpui2::{App, AppContext, AsyncAppContext, SemanticVersion, Task};
use gpui2::{App, AppContext, AsyncAppContext, Context, SemanticVersion, Task};
use isahc::{prelude::Configurable, Request};
use language2::LanguageRegistry;
use log::LevelFilter;
@@ -119,8 +120,8 @@ fn main() {
let languages = Arc::new(languages);
let node_runtime = RealNodeRuntime::new(http.clone());
languages2::init(languages.clone(), node_runtime.clone(), cx);
// let user_store = cx.add_model(|cx| UserStore::new(client.clone(), http.clone(), cx));
language2::init(cx);
let user_store = cx.entity(|cx| UserStore::new(client.clone(), http.clone(), cx));
// let workspace_store = cx.add_model(|cx| WorkspaceStore::new(client.clone(), cx));
cx.set_global(client.clone());
@@ -167,7 +168,7 @@ fn main() {
// client.telemetry().start(installation_id, session_id, cx);
// todo!("app_state")
let app_state = Arc::new(AppState);
let app_state = Arc::new(AppState { client, user_store });
// let app_state = Arc::new(AppState {
// languages,
// client: client.clone(),
+6 -2
View File
@@ -3,7 +3,8 @@ mod only_instance;
mod open_listener;
pub use assets::*;
use gpui2::AsyncAppContext;
use client2::{Client, UserStore};
use gpui2::{AsyncAppContext, Handle};
pub use only_instance::*;
pub use open_listener::*;
@@ -44,7 +45,10 @@ pub fn connect_to_cli(
Ok((async_request_rx, response_tx))
}
pub struct AppState;
pub struct AppState {
pub client: Arc<Client>,
pub user_store: Handle<UserStore>,
}
pub async fn handle_cli_connection(
(mut requests, _responses): (mpsc::Receiver<CliRequest>, IpcSender<CliResponse>),