cx.background_executor().spawn(...)
-> cx.background_spawn(...)
(#25103)
Done automatically with > ast-grep -p '$A.background_executor().spawn($B)' -r '$A.background_spawn($B)' --update-all --globs "\!crates/gpui" Followed by: * `cargo fmt` * Unexpected need to remove some trailing whitespace. * Manually adding imports of `gpui::{AppContext as _}` which provides `background_spawn` * Added `AppContext as _` to existing use of `AppContext` Release Notes: - N/A
This commit is contained in:
parent
f606b0641e
commit
b1872e3afd
120 changed files with 1146 additions and 1267 deletions
|
@ -324,10 +324,7 @@ impl ExtensionStore {
|
|||
load_initial_extensions.await;
|
||||
|
||||
let mut index_changed = false;
|
||||
let mut debounce_timer = cx
|
||||
.background_executor()
|
||||
.spawn(futures::future::pending())
|
||||
.fuse();
|
||||
let mut debounce_timer = cx.background_spawn(futures::future::pending()).fuse();
|
||||
loop {
|
||||
select_biased! {
|
||||
_ = debounce_timer => {
|
||||
|
@ -370,7 +367,7 @@ impl ExtensionStore {
|
|||
// Watch the installed extensions directory for changes. Whenever changes are
|
||||
// detected, rebuild the extension index, and load/unload any extensions that
|
||||
// have been added, removed, or modified.
|
||||
this.tasks.push(cx.background_executor().spawn({
|
||||
this.tasks.push(cx.background_spawn({
|
||||
let fs = this.fs.clone();
|
||||
let reload_tx = this.reload_tx.clone();
|
||||
let installed_dir = this.installed_dir.clone();
|
||||
|
@ -886,20 +883,19 @@ impl ExtensionStore {
|
|||
}
|
||||
});
|
||||
|
||||
cx.background_executor()
|
||||
.spawn({
|
||||
let extension_source_path = extension_source_path.clone();
|
||||
async move {
|
||||
builder
|
||||
.compile_extension(
|
||||
&extension_source_path,
|
||||
&mut extension_manifest,
|
||||
CompileExtensionOptions { release: false },
|
||||
)
|
||||
.await
|
||||
}
|
||||
})
|
||||
.await?;
|
||||
cx.background_spawn({
|
||||
let extension_source_path = extension_source_path.clone();
|
||||
async move {
|
||||
builder
|
||||
.compile_extension(
|
||||
&extension_source_path,
|
||||
&mut extension_manifest,
|
||||
CompileExtensionOptions { release: false },
|
||||
)
|
||||
.await
|
||||
}
|
||||
})
|
||||
.await?;
|
||||
|
||||
let output_path = &extensions_dir.join(extension_id.as_ref());
|
||||
if let Some(metadata) = fs.metadata(output_path).await? {
|
||||
|
@ -937,7 +933,7 @@ impl ExtensionStore {
|
|||
};
|
||||
|
||||
cx.notify();
|
||||
let compile = cx.background_executor().spawn(async move {
|
||||
let compile = cx.background_spawn(async move {
|
||||
let mut manifest = ExtensionManifest::load(fs, &path).await?;
|
||||
builder
|
||||
.compile_extension(
|
||||
|
@ -1192,35 +1188,33 @@ impl ExtensionStore {
|
|||
cx.emit(Event::ExtensionsUpdated);
|
||||
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
cx.background_executor()
|
||||
.spawn({
|
||||
let fs = fs.clone();
|
||||
async move {
|
||||
for theme_path in themes_to_add.into_iter() {
|
||||
proxy
|
||||
.load_user_theme(theme_path, fs.clone())
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
cx.background_spawn({
|
||||
let fs = fs.clone();
|
||||
async move {
|
||||
for theme_path in themes_to_add.into_iter() {
|
||||
proxy
|
||||
.load_user_theme(theme_path, fs.clone())
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
|
||||
for (icon_theme_path, icons_root_path) in icon_themes_to_add.into_iter() {
|
||||
proxy
|
||||
.load_icon_theme(icon_theme_path, icons_root_path, fs.clone())
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
for (icon_theme_path, icons_root_path) in icon_themes_to_add.into_iter() {
|
||||
proxy
|
||||
.load_icon_theme(icon_theme_path, icons_root_path, fs.clone())
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
|
||||
for snippets_path in &snippets_to_add {
|
||||
if let Some(snippets_contents) = fs.load(snippets_path).await.log_err()
|
||||
{
|
||||
proxy
|
||||
.register_snippet(snippets_path, &snippets_contents)
|
||||
.log_err();
|
||||
}
|
||||
for snippets_path in &snippets_to_add {
|
||||
if let Some(snippets_contents) = fs.load(snippets_path).await.log_err() {
|
||||
proxy
|
||||
.register_snippet(snippets_path, &snippets_contents)
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
})
|
||||
.await;
|
||||
}
|
||||
})
|
||||
.await;
|
||||
|
||||
let mut wasm_extensions = Vec::new();
|
||||
for extension in extension_entries {
|
||||
|
@ -1304,7 +1298,7 @@ impl ExtensionStore {
|
|||
let extensions_dir = self.installed_dir.clone();
|
||||
let index_path = self.index_path.clone();
|
||||
let proxy = self.proxy.clone();
|
||||
cx.background_executor().spawn(async move {
|
||||
cx.background_spawn(async move {
|
||||
let start_time = Instant::now();
|
||||
let mut index = ExtensionIndex::default();
|
||||
|
||||
|
@ -1494,7 +1488,7 @@ impl ExtensionStore {
|
|||
return Task::ready(Err(anyhow!("extension no longer installed")));
|
||||
};
|
||||
let fs = self.fs.clone();
|
||||
cx.background_executor().spawn(async move {
|
||||
cx.background_spawn(async move {
|
||||
const EXTENSION_TOML: &str = "extension.toml";
|
||||
const EXTENSION_WASM: &str = "extension.wasm";
|
||||
const CONFIG_TOML: &str = "config.toml";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue