Remove last usages of MultiBufferSnapshot::language

This commit is contained in:
Max Brunsfeld 2022-10-05 14:44:34 -07:00
parent aa86806408
commit 8b86781ad1
2 changed files with 4 additions and 9 deletions

View File

@ -2021,7 +2021,7 @@ impl Editor {
let end = selection.end;
let mut insert_extra_newline = false;
if let Some(language) = buffer.language() {
if let Some(language) = buffer.language_at(start) {
let leading_whitespace_len = buffer
.reversed_chars_at(start)
.take_while(|c| c.is_whitespace() && *c != '\n')
@ -2927,7 +2927,9 @@ impl Editor {
{
let indent_size =
buffer.indent_size_for_line(line_buffer_range.start.row);
let language_name = buffer.language().map(|language| language.name());
let language_name = buffer
.language_at(line_buffer_range.start)
.map(|language| language.name());
let indent_len = match indent_size.kind {
IndentKind::Space => {
cx.global::<Settings>().tab_size(language_name.as_deref())

View File

@ -2501,13 +2501,6 @@ impl MultiBufferSnapshot {
self.trailing_excerpt_update_count
}
pub fn language(&self) -> Option<&Arc<Language>> {
self.excerpts
.iter()
.next()
.and_then(|excerpt| excerpt.buffer.language())
}
pub fn language_at<'a, T: ToOffset>(&'a self, point: T) -> Option<&'a Arc<Language>> {
self.point_to_buffer_offset(point)
.and_then(|(buffer, offset)| buffer.language_at(offset))