Make Buffer::language_at fall back to Buffer::language

For languages with no grammar (plain text), there
will be no layers.
This commit is contained in:
Max Brunsfeld 2022-09-28 13:38:54 -07:00
parent 2da32af340
commit 4f44375abd
3 changed files with 12 additions and 0 deletions

View file

@ -26,6 +26,7 @@ use serde_json::Value;
use std::{
any::Any,
cell::RefCell,
fmt::Debug,
mem,
ops::Range,
path::{Path, PathBuf},
@ -866,6 +867,14 @@ impl Language {
}
}
impl Debug for Language {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Language")
.field("name", &self.config.name)
.finish()
}
}
impl Grammar {
pub fn id(&self) -> usize {
self.id