Fix #8028 - language server performance, fix warnings and critical errors
[roobuilder] / src / Palete / Gir.vala
index fca6a77..648f1c5 100644 (file)
@@ -141,15 +141,19 @@ namespace Palete {
                 * 
                 */
 
-               public static  Gee.HashMap<string,Gir> global_cache = null;
+       //      public static  Gee.HashMap<string,Gir> global_cache = null;
                
-               public static Gir?  factory(Project.Project?  project, string ns) 
+               public static GirObject?  factory(Project.Project?  project, string ns) 
                {
-                       if (global_cache == null) {
-                               global_cache = new Gee.HashMap<string,Gir>();
+                       
+                       if (project == null) {
+                               return null;
+                       }
+                       if (project.gir_cache == null) {
+                               project.gir_cache = new Gee.HashMap<string,GirObject>();
                                 
                        }
-                       var cache = global_cache;
+                       var cache = project.gir_cache;
                        if (project != null && project is Project.Gtk) {
                                var gproj = ((Project.Gtk)project);
                                if (!gproj.gir_cache_loaded) {
@@ -193,20 +197,20 @@ namespace Palete {
                        var fqn = in_fqn;
                        // swap Gtk.Source* to GtkSource.
                        
-                       GLib.debug("Gir.factoryFqn  search %s", fqn);
+                       //GLib.debug("Gir.factoryFqn  search %s", fqn);
                        var bits = fqn.split(".");
                        if (bits.length < 1) {
-                               GLib.debug("Gir.factoryFqn  fail - missing '.'");
+                               //GLib.debug("Gir.factoryFqn  fail - missing '.'");
                                return null;
                        }
                        
                        var f = (GirObject)factory(project , bits[0]);
 
                        if (bits.length == 1 || f ==null) {
-                               GLib.debug("Gir.factoryFqn  fail - factory failed to load NS");
+                               //GLib.debug("Gir.factoryFqn  fail - factory failed to load NS");
                                return f;
                        }
-                       GLib.debug("Gir.factoryFqn  fetching child %s", fqn.substring(bits[0].length+1));
+                       //GLib.debug("Gir.factoryFqn  fetching child %s", fqn.substring(bits[0].length+1));
                        return f.fetchByFqn(fqn.substring(bits[0].length+1)); // since classes are stored in fqn format...?