Run Project::diagnose when registering a new language on Worktree

This commit is contained in:
Antonio Scandurra 2022-01-03 16:58:36 +01:00
parent 2b31a48ef9
commit 496066db59
2 changed files with 6 additions and 1 deletions

View file

@ -475,7 +475,10 @@ impl Project {
fn add_worktree(&mut self, worktree: ModelHandle<Worktree>, cx: &mut ModelContext<Self>) {
cx.observe(&worktree, |_, _, cx| cx.notify()).detach();
cx.subscribe(&worktree, |_, worktree, event, cx| match event {
cx.subscribe(&worktree, |this, worktree, event, cx| match event {
worktree::Event::LanguageRegistered => {
this.diagnose(cx);
}
worktree::Event::DiagnosticsUpdated(path) => {
cx.emit(Event::DiagnosticsUpdated(ProjectPath {
worktree_id: worktree.id(),