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:
parent
4a577fff4a
commit
c208532693
79 changed files with 319 additions and 306 deletions
|
@ -117,7 +117,7 @@ impl LspCommand for ExpandMacro {
|
|||
.and_then(deserialize_anchor)
|
||||
.context("invalid position")?;
|
||||
Ok(Self {
|
||||
position: buffer.update(&mut cx, |buffer, _| position.to_point_utf16(buffer))?,
|
||||
position: buffer.read_with(&mut cx, |buffer, _| position.to_point_utf16(buffer))?,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ impl LspCommand for OpenDocs {
|
|||
.and_then(deserialize_anchor)
|
||||
.context("invalid position")?;
|
||||
Ok(Self {
|
||||
position: buffer.update(&mut cx, |buffer, _| position.to_point_utf16(buffer))?,
|
||||
position: buffer.read_with(&mut cx, |buffer, _| position.to_point_utf16(buffer))?,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ impl LspCommand for GoToParentModule {
|
|||
.and_then(deserialize_anchor)
|
||||
.context("bad request with bad position")?;
|
||||
Ok(Self {
|
||||
position: buffer.update(&mut cx, |buffer, _| position.to_point_utf16(buffer))?,
|
||||
position: buffer.read_with(&mut cx, |buffer, _| position.to_point_utf16(buffer))?,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ pub fn cancel_flycheck(
|
|||
else {
|
||||
return Ok(());
|
||||
};
|
||||
let buffer_id = buffer.update(cx, |buffer, _| buffer.remote_id().to_proto())?;
|
||||
let buffer_id = buffer.read_with(cx, |buffer, _| buffer.remote_id().to_proto())?;
|
||||
|
||||
if let Some((client, project_id)) = upstream_client {
|
||||
let request = proto::LspExtCancelFlycheck {
|
||||
|
@ -123,7 +123,7 @@ pub fn cancel_flycheck(
|
|||
.context("lsp ext cancel flycheck proto request")?;
|
||||
} else {
|
||||
lsp_store
|
||||
.update(cx, |lsp_store, _| {
|
||||
.read_with(cx, |lsp_store, _| {
|
||||
if let Some(server) = lsp_store.language_server_for_id(rust_analyzer_server) {
|
||||
server.notify::<lsp_store::lsp_ext_command::LspExtCancelFlycheck>(&())?;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ pub fn run_flycheck(
|
|||
else {
|
||||
return Ok(());
|
||||
};
|
||||
let buffer_id = buffer.update(cx, |buffer, _| buffer.remote_id().to_proto())?;
|
||||
let buffer_id = buffer.read_with(cx, |buffer, _| buffer.remote_id().to_proto())?;
|
||||
|
||||
if let Some((client, project_id)) = upstream_client {
|
||||
let request = proto::LspExtRunFlycheck {
|
||||
|
@ -175,7 +175,7 @@ pub fn run_flycheck(
|
|||
.context("lsp ext run flycheck proto request")?;
|
||||
} else {
|
||||
lsp_store
|
||||
.update(cx, |lsp_store, _| {
|
||||
.read_with(cx, |lsp_store, _| {
|
||||
if let Some(server) = lsp_store.language_server_for_id(rust_analyzer_server) {
|
||||
server.notify::<lsp_store::lsp_ext_command::LspExtRunFlycheck>(
|
||||
&lsp_store::lsp_ext_command::RunFlycheckParams {
|
||||
|
@ -216,7 +216,7 @@ pub fn clear_flycheck(
|
|||
else {
|
||||
return Ok(());
|
||||
};
|
||||
let buffer_id = buffer.update(cx, |buffer, _| buffer.remote_id().to_proto())?;
|
||||
let buffer_id = buffer.read_with(cx, |buffer, _| buffer.remote_id().to_proto())?;
|
||||
|
||||
if let Some((client, project_id)) = upstream_client {
|
||||
let request = proto::LspExtClearFlycheck {
|
||||
|
@ -230,7 +230,7 @@ pub fn clear_flycheck(
|
|||
.context("lsp ext clear flycheck proto request")?;
|
||||
} else {
|
||||
lsp_store
|
||||
.update(cx, |lsp_store, _| {
|
||||
.read_with(cx, |lsp_store, _| {
|
||||
if let Some(server) = lsp_store.language_server_for_id(rust_analyzer_server) {
|
||||
server.notify::<lsp_store::lsp_ext_command::LspExtClearFlycheck>(&())?;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue