sync
[app.Builder.js] / src / Builder4 / Editor.vala
index 09a5804..5eb55ee 100644 (file)
@@ -367,6 +367,28 @@ public class Editor : Object
         }
 
         // user defined functions 
+        public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
+                this.error_line = validate_res.size;
+        
+                if (this.error_line < 1) {
+                      return true;
+                }
+                var tlines = this.el.get_line_count ();
+                Gtk.TextIter iter;
+                var valiter = validate_res.map_iterator();
+                while (valiter.next()) {
+                
+            //        print("get inter\n");
+                    var eline = valiter.get_key();
+                    if (eline > tlines) {
+                        continue;
+                    }
+                    this.el.get_iter_at_line( out iter, eline);
+                    //print("mark line\n");
+                    this.el.create_source_mark(valiter.get_value(), "error", iter);
+                }   
+                return false;
+            }
         public   string toString () {
             
             Gtk.TextIter s;
@@ -421,7 +443,9 @@ public class Editor : Object
             
             
             if (_this.file.language == "js") {
-                return _this.highlightErrors(p.validateJavascript(
+                this.check_running = false;
+                print("calling validate javascript\n"); 
+                return this.highlightErrors(p.validateJavascript(
                     str, 
                      _this.key, 
                     _this.ptype,
@@ -431,8 +455,8 @@ public class Editor : Object
                 
             }
                 
-            print("calling validate code\n");    
-            p.validateCode.begin(
+            print("calling validate vala\n");    
+            p.validateVala.begin(
                 str, 
                  _this.key, 
                 _this.ptype,
@@ -440,27 +464,9 @@ public class Editor : Object
                 _this.node,
                 (obj, res) => {
                     this.check_running = false;
-                    var validate_res = p.validateCode.end(res);
-                    this.error_line = validate_res.size;
+                    var validate_res = p.validateVala.end(res);
+                    this.highlightErrors(validate_res);
         
-                    if (this.error_line < 1) {
-                          return;
-                    }
-                    var tlines = this.el.get_line_count ();
-                    Gtk.TextIter iter;
-                    var valiter = validate_res.map_iterator();
-                    while (valiter.next()) {
-                    
-                //        print("get inter\n");
-                        var eline = valiter.get_key();
-                        if (eline > tlines) {
-                            continue;
-                        }
-                        this.el.get_iter_at_line( out iter, eline);
-                        //print("mark line\n");
-                        this.el.create_source_mark(valiter.get_value(), "error", iter);
-                    }   
-                    
                 }
                 
             );