Update some editor methods to instead take immutable references (#23578)

Makes the signatures more informative and can be more convenient as
multiple immutable borrows are allowed.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-01-23 14:52:10 -07:00 committed by GitHub
parent 966533624a
commit 52494f3fdf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 21 deletions

View file

@ -6,7 +6,7 @@ use git::{
blame::{Blame, BlameEntry},
parse_git_remote_url, GitHostingProvider, GitHostingProviderRegistry, Oid, PullRequest,
};
use gpui::{Model, ModelContext, Subscription, Task};
use gpui::{AppContext, Model, ModelContext, Subscription, Task};
use http_client::HttpClient;
use language::{markdown, Bias, Buffer, BufferSnapshot, Edit, LanguageRegistry, ParsedMarkdown};
use multi_buffer::MultiBufferRow;
@ -195,7 +195,7 @@ impl GitBlame {
pub fn blame_for_rows<'a>(
&'a mut self,
rows: impl 'a + IntoIterator<Item = Option<MultiBufferRow>>,
cx: &mut ModelContext<Self>,
cx: &AppContext,
) -> impl 'a + Iterator<Item = Option<BlameEntry>> {
self.sync(cx);
@ -207,7 +207,7 @@ impl GitBlame {
})
}
pub fn max_author_length(&mut self, cx: &mut ModelContext<Self>) -> usize {
pub fn max_author_length(&mut self, cx: &AppContext) -> usize {
self.sync(cx);
let mut max_author_length = 0;
@ -240,7 +240,7 @@ impl GitBlame {
}
}
fn sync(&mut self, cx: &mut ModelContext<Self>) {
fn sync(&mut self, cx: &AppContext) {
let edits = self.buffer_edits.consume();
let new_snapshot = self.buffer.read(cx).snapshot();