Run Project::diagnose
when registering a new language on Worktree
This commit is contained in:
parent
2b31a48ef9
commit
496066db59
2 changed files with 6 additions and 1 deletions
|
@ -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(),
|
||||
|
|
|
@ -68,6 +68,7 @@ pub enum Worktree {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub enum Event {
|
||||
LanguageRegistered,
|
||||
DiagnosticsUpdated(Arc<Path>),
|
||||
}
|
||||
|
||||
|
@ -1060,6 +1061,7 @@ impl LocalWorktree {
|
|||
) -> Option<Arc<LanguageServer>> {
|
||||
if !self.languages.iter().any(|l| Arc::ptr_eq(l, language)) {
|
||||
self.languages.push(language.clone());
|
||||
cx.emit(Event::LanguageRegistered);
|
||||
}
|
||||
|
||||
if let Some(server) = self.language_servers.get(language.name()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue