[gnome-builder] codeui: notify diagnostics manager of language-set



commit 20a0f813478037b4d4831ab42327daad0693bd57
Author: Christian Hergert <chergert redhat com>
Date:   Fri Apr 19 13:29:23 2019 -0700

    codeui: notify diagnostics manager of language-set
    
    During the refactoring, a great deal of changes happened to how we use
    internal plugins to notify internal subsystems of changes. If the language
    isn't setup correctly initially, we failed to notify the diagnostics
    manager of that change (resulting in no diagnostic providers getting
    loaded).

 src/plugins/codeui/gbp-codeui-buffer-addin.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/src/plugins/codeui/gbp-codeui-buffer-addin.c b/src/plugins/codeui/gbp-codeui-buffer-addin.c
index ca26551f1..9abd16a27 100644
--- a/src/plugins/codeui/gbp-codeui-buffer-addin.c
+++ b/src/plugins/codeui/gbp-codeui-buffer-addin.c
@@ -129,6 +129,29 @@ gbp_codeui_buffer_addin_changed_cb (GbpCodeuiBufferAddin  *self,
     }
 }
 
+static void
+gbp_codeui_buffer_addin_language_set (IdeBufferAddin *addin,
+                                      IdeBuffer      *buffer,
+                                      const gchar    *language_id)
+{
+  g_autoptr(IdeContext) context = NULL;
+  IdeDiagnosticsManager *diagnostics_manager;
+  GFile *file;
+
+  g_assert (GBP_IS_CODEUI_BUFFER_ADDIN (addin));
+  g_assert (IDE_IS_BUFFER (buffer));
+
+  context = ide_buffer_ref_context (buffer);
+  file = ide_buffer_get_file (buffer);
+
+  g_assert (IDE_IS_CONTEXT (context));
+  g_assert (file != NULL);
+  g_assert (G_IS_FILE (file));
+
+  diagnostics_manager = ide_diagnostics_manager_from_context (context);
+  _ide_diagnostics_manager_language_changed (diagnostics_manager, file, language_id);
+}
+
 static void
 gbp_codeui_buffer_addin_load (IdeBufferAddin *addin,
                               IdeBuffer      *buffer)
@@ -185,6 +208,7 @@ buffer_addin_iface_init (IdeBufferAddinInterface *iface)
   iface->change_settled = gbp_codeui_buffer_addin_change_settled;
   iface->file_saved = gbp_codeui_buffer_addin_file_saved;
   iface->file_loaded = gbp_codeui_buffer_addin_file_loaded;
+  iface->language_set = gbp_codeui_buffer_addin_language_set;
   iface->load = gbp_codeui_buffer_addin_load;
   iface->unload = gbp_codeui_buffer_addin_unload;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]