[gnome-builder] foundry: Pass file to 'populate_diagnostics'



commit c9d4a91ec21ddb3019d7b0d545fb08df05c52bb4
Author: Veli Tasalı <veli tasali gmail com>
Date:   Sun Jan 23 13:19:41 2022 +0300

    foundry: Pass file to 'populate_diagnostics'
    
    Since IdeLocation object needs the file as an
    argument, providing the said function call is
    necessary.

 src/libide/foundry/ide-diagnostic-tool.c | 8 +++++++-
 src/libide/foundry/ide-diagnostic-tool.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/foundry/ide-diagnostic-tool.c b/src/libide/foundry/ide-diagnostic-tool.c
index 0b003c566..a556e6854 100644
--- a/src/libide/foundry/ide-diagnostic-tool.c
+++ b/src/libide/foundry/ide-diagnostic-tool.c
@@ -276,6 +276,7 @@ ide_diagnostic_tool_communicate_cb (GObject      *object,
   g_autofree char *stdout_buf = NULL;
   g_autofree char *stderr_buf = NULL;
   IdeDiagnosticTool *self;
+  GFile *file;
 
   IDE_ENTRY;
 
@@ -291,9 +292,12 @@ ide_diagnostic_tool_communicate_cb (GObject      *object,
 
   self = ide_task_get_source_object (task);
   diagnostics = ide_diagnostics_new ();
+  file = ide_task_get_task_data(task);
+
+  g_assert (!file || G_IS_FILE (file));
 
   if (IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->populate_diagnostics != NULL)
-    IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->populate_diagnostics (self, diagnostics, stdout_buf, stderr_buf);
+    IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->populate_diagnostics (self, diagnostics, file, stdout_buf, 
stderr_buf);
 
   ide_task_return_object (task, g_steal_pointer (&diagnostics));
 
@@ -352,6 +356,8 @@ ide_diagnostic_tool_diagnose_async (IdeDiagnosticProvider *provider,
   if ((stdin_bytes = IDE_DIAGNOSTIC_TOOL_GET_CLASS (self)->get_stdin_bytes (self, file, contents, lang_id)))
     stdin_data = g_bytes_get_data (stdin_bytes, NULL);
 
+  ide_task_set_task_data (task, g_object_ref(file), g_object_unref);
+
   ide_subprocess_communicate_utf8_async (subprocess,
                                          stdin_data,
                                          cancellable,
diff --git a/src/libide/foundry/ide-diagnostic-tool.h b/src/libide/foundry/ide-diagnostic-tool.h
index f498f084d..67de4534c 100644
--- a/src/libide/foundry/ide-diagnostic-tool.h
+++ b/src/libide/foundry/ide-diagnostic-tool.h
@@ -46,6 +46,7 @@ struct _IdeDiagnosticToolClass
                                                   const char             *language_id);
   void                   (*populate_diagnostics) (IdeDiagnosticTool      *self,
                                                   IdeDiagnostics         *diagnostics,
+                                                  GFile                  *file,
                                                   const char             *stdout_buf,
                                                   const char             *stderr_buf);
 };


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