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:
Michael Sloan 2025-02-18 13:30:33 -07:00 committed by GitHub
parent f606b0641e
commit b1872e3afd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
120 changed files with 1146 additions and 1267 deletions

View file

@ -5,7 +5,7 @@ use futures::{
stream::{SelectAll, StreamExt},
AsyncBufReadExt as _, SinkExt as _,
};
use gpui::{App, Entity, EntityId, Task, Window};
use gpui::{App, AppContext as _, Entity, EntityId, Task, Window};
use jupyter_protocol::{
connection_info::{ConnectionInfo, Transport},
ExecutionState, JupyterKernelspec, JupyterMessage, JupyterMessageContent, KernelInfoReply,
@ -211,7 +211,7 @@ impl NativeRunningKernel {
futures::channel::mpsc::channel(100);
let (mut shell_request_tx, mut shell_request_rx) = futures::channel::mpsc::channel(100);
let routing_task = cx.background_executor().spawn({
let routing_task = cx.background_spawn({
async move {
while let Some(message) = request_rx.next().await {
match message.content {
@ -229,7 +229,7 @@ impl NativeRunningKernel {
}
});
let shell_task = cx.background_executor().spawn({
let shell_task = cx.background_spawn({
async move {
while let Some(message) = shell_request_rx.next().await {
shell_socket.send(message).await.ok();
@ -240,7 +240,7 @@ impl NativeRunningKernel {
}
});
let control_task = cx.background_executor().spawn({
let control_task = cx.background_spawn({
async move {
while let Some(message) = control_request_rx.next().await {
control_socket.send(message).await.ok();

View file

@ -1,5 +1,5 @@
use futures::{channel::mpsc, SinkExt as _};
use gpui::{App, Entity, Task, Window};
use gpui::{App, AppContext as _, Entity, Task, Window};
use http_client::{AsyncBody, HttpClient, Request};
use jupyter_protocol::{ExecutionState, JupyterKernelspec, JupyterMessage, KernelInfoReply};
@ -189,7 +189,7 @@ impl RemoteRunningKernel {
let (request_tx, mut request_rx) =
futures::channel::mpsc::channel::<JupyterMessage>(100);
let routing_task = cx.background_executor().spawn({
let routing_task = cx.background_spawn({
async move {
while let Some(message) = request_rx.next().await {
w.send(message).await.ok();

View file

@ -134,8 +134,7 @@ impl Cell {
cx.spawn_in(window, |this, mut cx| async move {
let parsed_markdown = cx
.background_executor()
.spawn(async move {
.background_spawn(async move {
parse_markdown(&source, None, Some(languages)).await
})
.await;

View file

@ -19,9 +19,8 @@ impl MarkdownView {
pub fn from(text: String, cx: &mut Context<Self>) -> Self {
let task = cx.spawn(|markdown_view, mut cx| {
let text = text.clone();
let parsed = cx
.background_executor()
.spawn(async move { parse_markdown(&text, None, None).await });
let parsed =
cx.background_spawn(async move { parse_markdown(&text, None, None).await });
async move {
let content = parsed.await;

View file

@ -164,7 +164,7 @@ impl ReplStore {
let remote_kernel_specifications = self.get_remote_kernel_specifications(cx);
let all_specs = cx.background_executor().spawn(async move {
let all_specs = cx.background_spawn(async move {
let mut all_specs = local_kernel_specifications
.await?
.into_iter()