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

@ -7,7 +7,7 @@ use editor::{
scroll::Autoscroll,
Bias, Editor, ToPoint,
};
use gpui::{actions, impl_internal_actions, Action, App, Context, Global, Window};
use gpui::{actions, impl_internal_actions, Action, App, AppContext as _, Context, Global, Window};
use itertools::Itertools;
use language::Point;
use multi_buffer::MultiBufferRow;
@ -1185,8 +1185,7 @@ impl OnMatchingLines {
.clip_point(Point::new(range.end.0 + 1, 0), Bias::Left);
cx.spawn_in(window, |editor, mut cx| async move {
let new_selections = cx
.background_executor()
.spawn(async move {
.background_spawn(async move {
let mut line = String::new();
let mut new_selections = Vec::new();
let chunks = snapshot
@ -1513,22 +1512,20 @@ impl ShellExec {
if let Some(mut stdin) = running.stdin.take() {
if let Some(snapshot) = input_snapshot {
let range = range.clone();
cx.background_executor()
.spawn(async move {
for chunk in snapshot.text_for_range(range) {
if stdin.write_all(chunk.as_bytes()).log_err().is_none() {
return;
}
cx.background_spawn(async move {
for chunk in snapshot.text_for_range(range) {
if stdin.write_all(chunk.as_bytes()).log_err().is_none() {
return;
}
stdin.flush().log_err();
})
.detach();
}
stdin.flush().log_err();
})
.detach();
}
};
let output = cx
.background_executor()
.spawn(async move { running.wait_with_output() })
.background_spawn(async move { running.wait_with_output() })
.await;
let Some(output) = output.log_err() else {