[gnome-builder] ide-compile-commands: add every vala file in vala_info



commit 8296009d09c424267becbd9627acd872084646cd
Author: Fernando Fernandez <fernando softwareperonista com ar>
Date:   Tue Feb 18 23:23:39 2020 -0300

    ide-compile-commands: add every vala file in vala_info
    
    If command contains 'valac' adds every vala file in command

 src/libide/foundry/ide-compile-commands.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/src/libide/foundry/ide-compile-commands.c b/src/libide/foundry/ide-compile-commands.c
index a380a4418..9ad8f4b35 100644
--- a/src/libide/foundry/ide-compile-commands.c
+++ b/src/libide/foundry/ide-compile-commands.c
@@ -269,6 +269,27 @@ ide_compile_commands_load_worker (IdeTask      *task,
           info->command = g_strdup (command);
           g_ptr_array_add (vala_info, info);
         }
+
+      if (command != NULL && strstr (command, "valac"))
+        {
+          g_auto(GStrv) argv = NULL;
+          gint argc = 0;
+
+          if (!g_shell_parse_argv (command, &argc, &argv, NULL))
+            continue;
+
+          for (guint j = 0; j < argc; j++)
+            {
+              if (strstr (argv[j], ".vala"))
+                {
+                  info = g_slice_new0 (CompileInfo);
+                  info->file = g_file_resolve_relative_path (dir, argv[j]);
+                  info->directory = g_object_ref (dir);
+                  info->command = g_strdup (command);
+                  g_ptr_array_add (vala_info, info);
+                }
+            }
+        }
     }
 
   self->info_by_file = g_steal_pointer (&info_by_file);


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