Set buffer language when confirming selection in language selector

Co-Authored-By: Julia Risley <julia@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-02-24 16:28:56 +01:00
parent b402f27d50
commit 686f5439ad
5 changed files with 89 additions and 41 deletions

View file

@ -1254,6 +1254,15 @@ impl Editor {
self.buffer.read(cx).language_at(point, cx)
}
pub fn active_excerpt(
&self,
cx: &AppContext,
) -> Option<(ExcerptId, ModelHandle<Buffer>, Range<text::Anchor>)> {
self.buffer
.read(cx)
.excerpt_containing(self.selections.newest_anchor().head(), cx)
}
fn style(&self, cx: &AppContext) -> EditorStyle {
build_style(
cx.global::<Settings>(),