mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-02 16:33:05 +00:00
Assume all excerpts in the multi buffer have the same language for now
This commit is contained in:
parent
04ffca95c6
commit
174b37cdf0
1 changed files with 9 additions and 4 deletions
|
@ -452,12 +452,14 @@ impl MultiBuffer {
|
|||
}
|
||||
|
||||
pub fn language<'a>(&self, cx: &'a AppContext) -> Option<&'a Arc<Language>> {
|
||||
self.as_singleton().unwrap().read(cx).language()
|
||||
self.buffers
|
||||
.values()
|
||||
.next()
|
||||
.and_then(|state| state.buffer.read(cx).language())
|
||||
}
|
||||
|
||||
pub fn file<'a>(&self, cx: &'a AppContext) -> Option<&'a dyn File> {
|
||||
self.as_singleton()
|
||||
.and_then(|buffer| buffer.read(cx).file())
|
||||
self.as_singleton().unwrap().read(cx).file()
|
||||
}
|
||||
|
||||
pub fn is_dirty(&self, cx: &AppContext) -> bool {
|
||||
|
@ -1057,7 +1059,10 @@ impl MultiBufferSnapshot {
|
|||
}
|
||||
|
||||
pub fn language(&self) -> Option<&Arc<Language>> {
|
||||
self.as_singleton().unwrap().language()
|
||||
self.excerpts
|
||||
.iter()
|
||||
.next()
|
||||
.and_then(|excerpt| excerpt.buffer.language())
|
||||
}
|
||||
|
||||
pub fn diagnostic_group<'a, O>(
|
||||
|
|
Loading…
Reference in a new issue