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

@ -40,7 +40,8 @@ pub use crease_map::*;
pub use fold_map::{Fold, FoldId, FoldPlaceholder, FoldPoint};
use fold_map::{FoldMap, FoldSnapshot};
use gpui::{
AnyElement, Font, HighlightStyle, LineLayout, Model, ModelContext, Pixels, UnderlineStyle,
AnyElement, AppContext, Font, HighlightStyle, LineLayout, Model, ModelContext, Pixels,
UnderlineStyle,
};
pub use inlay_map::Inlay;
use inlay_map::{InlayMap, InlaySnapshot};
@ -543,7 +544,7 @@ impl DisplayMap {
self.block_map.read(snapshot, edits);
}
fn tab_size(buffer: &Model<MultiBuffer>, cx: &mut ModelContext<Self>) -> NonZeroU32 {
fn tab_size(buffer: &Model<MultiBuffer>, cx: &AppContext) -> NonZeroU32 {
let buffer = buffer.read(cx).as_singleton().map(|buffer| buffer.read(cx));
let language = buffer
.and_then(|buffer| buffer.language())