Checkpoint

This commit is contained in:
Antonio Scandurra 2023-10-24 16:15:01 +02:00
parent 9aaf7d0c46
commit 11953e613b
12 changed files with 507 additions and 404 deletions

56
Cargo.lock generated
View File

@ -4973,7 +4973,6 @@ dependencies = [
"async-tar", "async-tar",
"async-trait", "async-trait",
"futures 0.3.28", "futures 0.3.28",
"gpui",
"log", "log",
"parking_lot 0.11.2", "parking_lot 0.11.2",
"serde", "serde",
@ -5973,6 +5972,61 @@ dependencies = [
"util", "util",
] ]
[[package]]
name = "project2"
version = "0.1.0"
dependencies = [
"aho-corasick",
"anyhow",
"async-trait",
"backtrace",
"client2",
"clock",
"collections",
"copilot2",
"ctor",
"db2",
"env_logger 0.9.3",
"fs",
"fsevent",
"futures 0.3.28",
"fuzzy2",
"git",
"git2",
"globset",
"gpui2",
"ignore",
"itertools 0.10.5",
"language2",
"lazy_static",
"log",
"lsp2",
"node_runtime",
"parking_lot 0.11.2",
"postage",
"prettier2",
"pretty_assertions",
"rand 0.8.5",
"regex",
"rpc",
"schemars",
"serde",
"serde_derive",
"serde_json",
"settings2",
"sha2 0.10.7",
"similar",
"smol",
"sum_tree",
"tempdir",
"terminal2",
"text",
"thiserror",
"toml 0.5.11",
"unindent",
"util",
]
[[package]] [[package]]
name = "project_panel" name = "project_panel"
version = "0.1.0" version = "0.1.0"

View File

@ -63,7 +63,7 @@ members = [
"crates/prettier", "crates/prettier",
"crates/prettier2", "crates/prettier2",
"crates/project", "crates/project",
# "crates/project2", "crates/project2",
"crates/project_panel", "crates/project_panel",
"crates/project_symbols", "crates/project_symbols",
"crates/recent_projects", "crates/recent_projects",

View File

@ -163,10 +163,11 @@ impl App {
type ActionBuilder = fn(json: Option<serde_json::Value>) -> anyhow::Result<Box<dyn Action>>; type ActionBuilder = fn(json: Option<serde_json::Value>) -> anyhow::Result<Box<dyn Action>>;
type FrameCallback = Box<dyn FnOnce(&mut WindowContext) + Send>; type FrameCallback = Box<dyn FnOnce(&mut WindowContext) + Send>;
type Handler = Box<dyn Fn(&mut AppContext) -> bool + Send + Sync + 'static>; type Handler = Box<dyn FnMut(&mut AppContext) -> bool + Send + Sync + 'static>;
type Listener = Box<dyn Fn(&dyn Any, &mut AppContext) -> bool + Send + Sync + 'static>; type Listener = Box<dyn FnMut(&dyn Any, &mut AppContext) -> bool + Send + Sync + 'static>;
type QuitHandler = Box<dyn Fn(&mut AppContext) -> BoxFuture<'static, ()> + Send + Sync + 'static>; type QuitHandler =
type ReleaseListener = Box<dyn Fn(&mut dyn Any, &mut AppContext) + Send + Sync + 'static>; Box<dyn FnMut(&mut AppContext) -> BoxFuture<'static, ()> + Send + Sync + 'static>;
type ReleaseListener = Box<dyn FnMut(&mut dyn Any, &mut AppContext) + Send + Sync + 'static>;
pub struct AppContext { pub struct AppContext {
this: Weak<Mutex<AppContext>>, this: Weak<Mutex<AppContext>>,
@ -355,7 +356,7 @@ impl AppContext {
for (entity_id, mut entity) in dropped { for (entity_id, mut entity) in dropped {
self.observers.remove(&entity_id); self.observers.remove(&entity_id);
self.event_listeners.remove(&entity_id); self.event_listeners.remove(&entity_id);
for release_callback in self.release_listeners.remove(&entity_id) { for mut release_callback in self.release_listeners.remove(&entity_id) {
release_callback(&mut entity, self); release_callback(&mut entity, self);
} }
} }
@ -571,7 +572,7 @@ impl AppContext {
pub fn observe_global<G: 'static>( pub fn observe_global<G: 'static>(
&mut self, &mut self,
f: impl Fn(&mut Self) + Send + Sync + 'static, mut f: impl FnMut(&mut Self) + Send + Sync + 'static,
) -> Subscription { ) -> Subscription {
self.global_observers.insert( self.global_observers.insert(
TypeId::of::<G>(), TypeId::of::<G>(),

View File

@ -43,7 +43,7 @@ impl<'a, T: 'static> ModelContext<'a, T> {
pub fn observe<T2: 'static>( pub fn observe<T2: 'static>(
&mut self, &mut self,
handle: &Handle<T2>, handle: &Handle<T2>,
on_notify: impl Fn(&mut T, Handle<T2>, &mut ModelContext<'_, T>) + Send + Sync + 'static, mut on_notify: impl FnMut(&mut T, Handle<T2>, &mut ModelContext<'_, T>) + Send + Sync + 'static,
) -> Subscription ) -> Subscription
where where
T: Any + Send + Sync, T: Any + Send + Sync,
@ -66,7 +66,7 @@ impl<'a, T: 'static> ModelContext<'a, T> {
pub fn subscribe<E: 'static + EventEmitter>( pub fn subscribe<E: 'static + EventEmitter>(
&mut self, &mut self,
handle: &Handle<E>, handle: &Handle<E>,
on_event: impl Fn(&mut T, Handle<E>, &E::Event, &mut ModelContext<'_, T>) mut on_event: impl FnMut(&mut T, Handle<E>, &E::Event, &mut ModelContext<'_, T>)
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
@ -92,7 +92,7 @@ impl<'a, T: 'static> ModelContext<'a, T> {
pub fn on_release( pub fn on_release(
&mut self, &mut self,
on_release: impl Fn(&mut T, &mut AppContext) + Send + Sync + 'static, mut on_release: impl FnMut(&mut T, &mut AppContext) + Send + Sync + 'static,
) -> Subscription ) -> Subscription
where where
T: 'static, T: 'static,
@ -109,7 +109,7 @@ impl<'a, T: 'static> ModelContext<'a, T> {
pub fn observe_release<E: 'static>( pub fn observe_release<E: 'static>(
&mut self, &mut self,
handle: &Handle<E>, handle: &Handle<E>,
on_release: impl Fn(&mut T, &mut E, &mut ModelContext<'_, T>) + Send + Sync + 'static, mut on_release: impl FnMut(&mut T, &mut E, &mut ModelContext<'_, T>) + Send + Sync + 'static,
) -> Subscription ) -> Subscription
where where
T: Any + Send + Sync, T: Any + Send + Sync,
@ -128,7 +128,7 @@ impl<'a, T: 'static> ModelContext<'a, T> {
pub fn observe_global<G: 'static>( pub fn observe_global<G: 'static>(
&mut self, &mut self,
f: impl Fn(&mut T, &mut ModelContext<'_, T>) + Send + Sync + 'static, mut f: impl FnMut(&mut T, &mut ModelContext<'_, T>) + Send + Sync + 'static,
) -> Subscription ) -> Subscription
where where
T: Any + Send + Sync, T: Any + Send + Sync,
@ -142,7 +142,7 @@ impl<'a, T: 'static> ModelContext<'a, T> {
pub fn on_app_quit<Fut>( pub fn on_app_quit<Fut>(
&mut self, &mut self,
on_quit: impl Fn(&mut T, &mut ModelContext<T>) -> Fut + Send + Sync + 'static, mut on_quit: impl FnMut(&mut T, &mut ModelContext<T>) -> Fut + Send + Sync + 'static,
) -> Subscription ) -> Subscription
where where
Fut: 'static + Future<Output = ()> + Send, Fut: 'static + Future<Output = ()> + Send,

View File

@ -1418,7 +1418,10 @@ impl<'a, 'w, V: 'static> ViewContext<'a, 'w, V> {
pub fn observe<E>( pub fn observe<E>(
&mut self, &mut self,
handle: &Handle<E>, handle: &Handle<E>,
on_notify: impl Fn(&mut V, Handle<E>, &mut ViewContext<'_, '_, V>) + Send + Sync + 'static, mut on_notify: impl FnMut(&mut V, Handle<E>, &mut ViewContext<'_, '_, V>)
+ Send
+ Sync
+ 'static,
) -> Subscription ) -> Subscription
where where
E: 'static, E: 'static,
@ -1446,7 +1449,7 @@ impl<'a, 'w, V: 'static> ViewContext<'a, 'w, V> {
pub fn subscribe<E: EventEmitter>( pub fn subscribe<E: EventEmitter>(
&mut self, &mut self,
handle: &Handle<E>, handle: &Handle<E>,
on_event: impl Fn(&mut V, Handle<E>, &E::Event, &mut ViewContext<'_, '_, V>) mut on_event: impl FnMut(&mut V, Handle<E>, &E::Event, &mut ViewContext<'_, '_, V>)
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
@ -1473,7 +1476,7 @@ impl<'a, 'w, V: 'static> ViewContext<'a, 'w, V> {
pub fn on_release( pub fn on_release(
&mut self, &mut self,
on_release: impl Fn(&mut V, &mut WindowContext) + Send + Sync + 'static, mut on_release: impl FnMut(&mut V, &mut WindowContext) + Send + Sync + 'static,
) -> Subscription { ) -> Subscription {
let window_handle = self.window.handle; let window_handle = self.window.handle;
self.app.release_listeners.insert( self.app.release_listeners.insert(
@ -1489,7 +1492,7 @@ impl<'a, 'w, V: 'static> ViewContext<'a, 'w, V> {
pub fn observe_release<T: 'static>( pub fn observe_release<T: 'static>(
&mut self, &mut self,
handle: &Handle<T>, handle: &Handle<T>,
on_release: impl Fn(&mut V, &mut T, &mut ViewContext<'_, '_, V>) + Send + Sync + 'static, mut on_release: impl FnMut(&mut V, &mut T, &mut ViewContext<'_, '_, V>) + Send + Sync + 'static,
) -> Subscription ) -> Subscription
where where
V: Any + Send + Sync, V: Any + Send + Sync,

View File

@ -9,7 +9,6 @@ path = "src/node_runtime.rs"
doctest = false doctest = false
[dependencies] [dependencies]
gpui = { path = "../gpui" }
util = { path = "../util" } util = { path = "../util" }
async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] } async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }
async-tar = "0.4.2" async-tar = "0.4.2"

View File

@ -37,7 +37,7 @@ prettier2 = { path = "../prettier2" }
rpc = { path = "../rpc" } rpc = { path = "../rpc" }
settings2 = { path = "../settings2" } settings2 = { path = "../settings2" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
terminal = { path = "../terminal" } terminal2 = { path = "../terminal2" }
util = { path = "../util" } util = { path = "../util" }
aho-corasick = "1.1" aho-corasick = "1.1"

View File

@ -32,8 +32,8 @@ pub fn lsp_formatting_options(tab_size: u32) -> lsp2::FormattingOptions {
} }
} }
#[async_trait(?Send)] #[async_trait]
pub(crate) trait LspCommand: 'static + Sized { pub(crate) trait LspCommand: 'static + Sized + Send {
type Response: 'static + Default + Send; type Response: 'static + Default + Send;
type LspRequest: 'static + Send + lsp2::request::Request; type LspRequest: 'static + Send + lsp2::request::Request;
type ProtoRequest: 'static + Send + proto::RequestMessage; type ProtoRequest: 'static + Send + proto::RequestMessage;
@ -148,7 +148,7 @@ impl From<lsp2::FormattingOptions> for FormattingOptions {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for PrepareRename { impl LspCommand for PrepareRename {
type Response = Option<Range<Anchor>>; type Response = Option<Range<Anchor>>;
type LspRequest = lsp2::request::PrepareRenameRequest; type LspRequest = lsp2::request::PrepareRenameRequest;
@ -183,7 +183,7 @@ impl LspCommand for PrepareRename {
_: Handle<Project>, _: Handle<Project>,
buffer: Handle<Buffer>, buffer: Handle<Buffer>,
_: LanguageServerId, _: LanguageServerId,
cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<Option<Range<Anchor>>> { ) -> Result<Option<Range<Anchor>>> {
buffer.update(&mut cx, |buffer, _| { buffer.update(&mut cx, |buffer, _| {
if let Some( if let Some(
@ -279,7 +279,7 @@ impl LspCommand for PrepareRename {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for PerformRename { impl LspCommand for PerformRename {
type Response = ProjectTransaction; type Response = ProjectTransaction;
type LspRequest = lsp2::request::Rename; type LspRequest = lsp2::request::Rename;
@ -398,7 +398,7 @@ impl LspCommand for PerformRename {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetDefinition { impl LspCommand for GetDefinition {
type Response = Vec<LocationLink>; type Response = Vec<LocationLink>;
type LspRequest = lsp2::request::GotoDefinition; type LspRequest = lsp2::request::GotoDefinition;
@ -491,7 +491,7 @@ impl LspCommand for GetDefinition {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetTypeDefinition { impl LspCommand for GetTypeDefinition {
type Response = Vec<LocationLink>; type Response = Vec<LocationLink>;
type LspRequest = lsp2::request::GotoTypeDefinition; type LspRequest = lsp2::request::GotoTypeDefinition;
@ -783,7 +783,7 @@ fn location_links_to_proto(
.collect() .collect()
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetReferences { impl LspCommand for GetReferences {
type Response = Vec<Location>; type Response = Vec<Location>;
type LspRequest = lsp2::request::References; type LspRequest = lsp2::request::References;
@ -836,17 +836,19 @@ impl LspCommand for GetReferences {
})? })?
.await?; .await?;
target_buffer_handle.update(&mut cx, |target_buffer, cx| { target_buffer_handle
let target_start = target_buffer .clone()
.clip_point_utf16(point_from_lsp(lsp_location.range.start), Bias::Left); .update(&mut cx, |target_buffer, _| {
let target_end = target_buffer let target_start = target_buffer
.clip_point_utf16(point_from_lsp(lsp_location.range.end), Bias::Left); .clip_point_utf16(point_from_lsp(lsp_location.range.start), Bias::Left);
references.push(Location { let target_end = target_buffer
buffer: target_buffer_handle, .clip_point_utf16(point_from_lsp(lsp_location.range.end), Bias::Left);
range: target_buffer.anchor_after(target_start) references.push(Location {
..target_buffer.anchor_before(target_end), buffer: target_buffer_handle,
}); range: target_buffer.anchor_after(target_start)
})?; ..target_buffer.anchor_before(target_end),
});
})?;
} }
} }
@ -943,7 +945,7 @@ impl LspCommand for GetReferences {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetDocumentHighlights { impl LspCommand for GetDocumentHighlights {
type Response = Vec<DocumentHighlight>; type Response = Vec<DocumentHighlight>;
type LspRequest = lsp2::request::DocumentHighlightRequest; type LspRequest = lsp2::request::DocumentHighlightRequest;
@ -978,7 +980,7 @@ impl LspCommand for GetDocumentHighlights {
_: Handle<Project>, _: Handle<Project>,
buffer: Handle<Buffer>, buffer: Handle<Buffer>,
_: LanguageServerId, _: LanguageServerId,
cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<Vec<DocumentHighlight>> { ) -> Result<Vec<DocumentHighlight>> {
buffer.update(&mut cx, |buffer, _| { buffer.update(&mut cx, |buffer, _| {
let mut lsp_highlights = lsp_highlights.unwrap_or_default(); let mut lsp_highlights = lsp_highlights.unwrap_or_default();
@ -1094,7 +1096,7 @@ impl LspCommand for GetDocumentHighlights {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetHover { impl LspCommand for GetHover {
type Response = Option<Hover>; type Response = Option<Hover>;
type LspRequest = lsp2::request::HoverRequest; type LspRequest = lsp2::request::HoverRequest;
@ -1130,7 +1132,7 @@ impl LspCommand for GetHover {
return Ok(None); return Ok(None);
}; };
let (language, range) = buffer.update(&mut cx, |buffer, cx| { let (language, range) = buffer.update(&mut cx, |buffer, _| {
( (
buffer.language().cloned(), buffer.language().cloned(),
hover.range.map(|range| { hover.range.map(|range| {
@ -1272,7 +1274,7 @@ impl LspCommand for GetHover {
message: proto::GetHoverResponse, message: proto::GetHoverResponse,
_: Handle<Project>, _: Handle<Project>,
buffer: Handle<Buffer>, buffer: Handle<Buffer>,
cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<Self::Response> { ) -> Result<Self::Response> {
let contents: Vec<_> = message let contents: Vec<_> = message
.contents .contents
@ -1312,7 +1314,7 @@ impl LspCommand for GetHover {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetCompletions { impl LspCommand for GetCompletions {
type Response = Vec<Completion>; type Response = Vec<Completion>;
type LspRequest = lsp2::request::Completion; type LspRequest = lsp2::request::Completion;
@ -1342,7 +1344,7 @@ impl LspCommand for GetCompletions {
_: Handle<Project>, _: Handle<Project>,
buffer: Handle<Buffer>, buffer: Handle<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<Vec<Completion>> { ) -> Result<Vec<Completion>> {
let mut response_list = None; let mut response_list = None;
let completions = if let Some(completions) = completions { let completions = if let Some(completions) = completions {
@ -1543,7 +1545,7 @@ impl LspCommand for GetCompletions {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for GetCodeActions { impl LspCommand for GetCodeActions {
type Response = Vec<CodeAction>; type Response = Vec<CodeAction>;
type LspRequest = lsp2::request::CodeActionRequest; type LspRequest = lsp2::request::CodeActionRequest;
@ -1682,7 +1684,7 @@ impl LspCommand for GetCodeActions {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for OnTypeFormatting { impl LspCommand for OnTypeFormatting {
type Response = Option<Transaction>; type Response = Option<Transaction>;
type LspRequest = lsp2::request::OnTypeFormatting; type LspRequest = lsp2::request::OnTypeFormatting;
@ -2190,7 +2192,7 @@ impl InlayHints {
} }
} }
#[async_trait(?Send)] #[async_trait]
impl LspCommand for InlayHints { impl LspCommand for InlayHints {
type Response = Vec<InlayHint>; type Response = Vec<InlayHint>;
type LspRequest = lsp2::InlayHintRequest; type LspRequest = lsp2::InlayHintRequest;
@ -2253,7 +2255,7 @@ impl LspCommand for InlayHints {
}; };
let buffer = buffer.clone(); let buffer = buffer.clone();
cx.spawn(|mut cx| async move { cx.spawn(move |mut cx| async move {
InlayHints::lsp_to_project_hint( InlayHints::lsp_to_project_hint(
lsp_hint, lsp_hint,
&buffer, &buffer,

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
use crate::Project; use crate::Project;
use gpui2::{AnyWindowHandle, Handle, ModelContext, WeakHandle}; use gpui2::{AnyWindowHandle, Context, Handle, ModelContext, WeakHandle};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use terminal::{ use terminal2::{
terminal_settings::{self, TerminalSettings, VenvSettingsContent}, terminal_settings::{self, TerminalSettings, VenvSettingsContent},
Terminal, TerminalBuilder, Terminal, TerminalBuilder,
}; };
@ -10,7 +10,7 @@ use terminal::{
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
pub struct Terminals { pub struct Terminals {
pub(crate) local_handles: Vec<WeakHandle<terminal::Terminal>>, pub(crate) local_handles: Vec<WeakHandle<terminal2::Terminal>>,
} }
impl Project { impl Project {
@ -36,19 +36,23 @@ impl Project {
Some(settings.blinking.clone()), Some(settings.blinking.clone()),
settings.alternate_scroll, settings.alternate_scroll,
window, window,
|index, cx| todo!("color_for_index"),
) )
.map(|builder| { .map(|builder| {
let terminal_handle = cx.add_model(|cx| builder.subscribe(cx)); let terminal_handle = cx.entity(|cx| builder.subscribe(cx));
self.terminals self.terminals
.local_handles .local_handles
.push(terminal_handle.downgrade()); .push(terminal_handle.downgrade());
let id = terminal_handle.id(); let id = terminal_handle.entity_id();
cx.observe_release(&terminal_handle, move |project, _terminal, cx| { cx.observe_release(&terminal_handle, move |project, _terminal, cx| {
let handles = &mut project.terminals.local_handles; let handles = &mut project.terminals.local_handles;
if let Some(index) = handles.iter().position(|terminal| terminal.id() == id) { if let Some(index) = handles
.iter()
.position(|terminal| terminal.entity_id() == id)
{
handles.remove(index); handles.remove(index);
cx.notify(); cx.notify();
} }
@ -116,7 +120,7 @@ impl Project {
} }
} }
pub fn local_terminal_handles(&self) -> &Vec<WeakHandle<terminal::Terminal>> { pub fn local_terminal_handles(&self) -> &Vec<WeakHandle<terminal2::Terminal>> {
&self.terminals.local_handles &self.terminals.local_handles
} }
} }

View File

@ -399,7 +399,7 @@ impl Worktree {
}) })
} }
pub fn remote<C: Context>( pub fn remote(
project_remote_id: u64, project_remote_id: u64,
replica_id: ReplicaId, replica_id: ReplicaId,
worktree: proto::WorktreeMetadata, worktree: proto::WorktreeMetadata,
@ -935,7 +935,7 @@ impl LocalWorktree {
let version = buffer.version(); let version = buffer.version();
let save = self.write_file(path, text, buffer.line_ending(), cx); let save = self.write_file(path, text, buffer.line_ending(), cx);
cx.spawn(|this, mut cx| async move { cx.spawn(move |this, mut cx| async move {
let entry = save.await?; let entry = save.await?;
let this = this.upgrade().context("worktree dropped")?; let this = this.upgrade().context("worktree dropped")?;
@ -1245,7 +1245,7 @@ impl LocalWorktree {
.unbounded_send((self.snapshot(), Arc::from([]), Arc::from([]))) .unbounded_send((self.snapshot(), Arc::from([]), Arc::from([])))
.ok(); .ok();
let worktree_id = cx.entity_id().; let worktree_id = cx.entity_id().as_u64();
let _maintain_remote_snapshot = cx.executor().spawn(async move { let _maintain_remote_snapshot = cx.executor().spawn(async move {
let mut is_first = true; let mut is_first = true;
while let Some((snapshot, entry_changes, repo_changes)) = snapshots_rx.next().await { while let Some((snapshot, entry_changes, repo_changes)) = snapshots_rx.next().await {
@ -1338,7 +1338,7 @@ impl RemoteWorktree {
let version = buffer.version(); let version = buffer.version();
let rpc = self.client.clone(); let rpc = self.client.clone();
let project_id = self.project_id; let project_id = self.project_id;
cx.spawn(|_, mut cx| async move { cx.spawn(move |_, mut cx| async move {
let response = rpc let response = rpc
.request(proto::SaveBuffer { .request(proto::SaveBuffer {
project_id, project_id,
@ -1446,7 +1446,7 @@ impl RemoteWorktree {
cx: &mut ModelContext<Worktree>, cx: &mut ModelContext<Worktree>,
) -> Task<Result<()>> { ) -> Task<Result<()>> {
let wait_for_snapshot = self.wait_for_snapshot(scan_id); let wait_for_snapshot = self.wait_for_snapshot(scan_id);
cx.spawn(|this, mut cx| async move { cx.spawn(move |this, mut cx| async move {
wait_for_snapshot.await?; wait_for_snapshot.await?;
this.update(&mut cx, |worktree, _| { this.update(&mut cx, |worktree, _| {
let worktree = worktree.as_remote_mut().unwrap(); let worktree = worktree.as_remote_mut().unwrap();

View File

@ -111,7 +111,7 @@ fn main() {
// handle_keymap_file_changes(user_keymap_file_rx, cx); // handle_keymap_file_changes(user_keymap_file_rx, cx);
// let client = client2::Client::new(http.clone(), cx); // let client = client2::Client::new(http.clone(), cx);
let mut languages = LanguageRegistry::new(login_shell_env_loaded); let languages = LanguageRegistry::new(login_shell_env_loaded);
let copilot_language_server_id = languages.next_language_server_id(); let copilot_language_server_id = languages.next_language_server_id();
// languages.set_executor(cx.background().clone()); // languages.set_executor(cx.background().clone());
// languages.set_language_server_download_dir(paths::LANGUAGES_DIR.clone()); // languages.set_language_server_download_dir(paths::LANGUAGES_DIR.clone());