Use read-only access methods for read-only entity operations (#31479)

Another follow-up to #31254

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-05-26 23:04:31 -04:00 committed by GitHub
parent 4a577fff4a
commit c208532693
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
79 changed files with 319 additions and 306 deletions

View file

@ -267,7 +267,7 @@ impl BreakpointStore {
message: TypedEnvelope<proto::ToggleBreakpoint>,
mut cx: AsyncApp,
) -> Result<proto::Ack> {
let breakpoints = this.update(&mut cx, |this, _| this.breakpoint_store())?;
let breakpoints = this.read_with(&mut cx, |this, _| this.breakpoint_store())?;
let path = this
.update(&mut cx, |this, cx| {
this.project_path_for_absolute_path(message.payload.path.as_ref(), cx)
@ -803,7 +803,7 @@ impl BreakpointStore {
log::error!("Todo: Serialized breakpoints which do not have buffer (yet)");
continue;
};
let snapshot = buffer.update(cx, |buffer, _| buffer.snapshot())?;
let snapshot = buffer.read_with(cx, |buffer, _| buffer.snapshot())?;
let mut breakpoints_for_file =
this.update(cx, |_, cx| BreakpointsInFile::new(buffer, cx))?;

View file

@ -232,7 +232,7 @@ impl DapStore {
cx.spawn(async move |_, cx| {
let response = request.await?;
let binary = DebugAdapterBinary::from_proto(response)?;
let mut ssh_command = ssh_client.update(cx, |ssh, _| {
let mut ssh_command = ssh_client.read_with(cx, |ssh, _| {
anyhow::Ok(SshCommand {
arguments: ssh.ssh_args().context("SSH arguments not found")?,
})
@ -609,7 +609,7 @@ impl DapStore {
});
}
VariableLookupKind::Expression => {
let Ok(eval_task) = session.update(cx, |session, _| {
let Ok(eval_task) = session.read_with(cx, |session, _| {
session.mode.request_dap(EvaluateCommand {
expression: inline_value_location.variable_name.clone(),
frame_id: Some(stack_frame_id),
@ -752,7 +752,7 @@ impl DapStore {
let this = this.clone();
async move |cx| {
while let Some(message) = rx.next().await {
this.update(cx, |this, _| {
this.read_with(cx, |this, _| {
if let Some((downstream, project_id)) = this.downstream_client.clone() {
downstream
.send(proto::LogToDebugConsole {

View file

@ -407,7 +407,7 @@ impl LocalMode {
let configuration_sequence = cx.spawn({
async move |cx| {
let breakpoint_store =
dap_store.update(cx, |dap_store, _| dap_store.breakpoint_store().clone())?;
dap_store.read_with(cx, |dap_store, _| dap_store.breakpoint_store().clone())?;
initialized_rx.await?;
let errors_by_path = cx
.update(|cx| this.send_source_breakpoints(false, &breakpoint_store, cx))?