src/Builder4/WindowRooView.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 7 Jun 2016 08:34:40 +0000 (16:34 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 7 Jun 2016 08:34:40 +0000 (16:34 +0800)
src/Builder4/WindowRooView.vala

src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala

index 59d62ed..d1112ed 100644 (file)
            "bool dirty" : false,
            "id" : "buffer",
            "int error_line" : "-1",
-           "| bool highlightErrors" : "( Gee.HashMap<int,string> validate_res) {\n         \n    this.error_line = validate_res.size;\n\n    if (this.error_line < 1) {\n          return true;\n    }\n    var tlines = this.el.get_line_count ();\n    Gtk.TextIter iter;\n    var valiter = validate_res.map_iterator();\n    while (valiter.next()) {\n    \n//        print(\"get inter\\n\");\n        var eline = valiter.get_key();\n        if (eline > tlines) {\n            continue;\n        }\n        this.el.get_iter_at_line( out iter, eline);\n        //print(\"mark line\\n\");\n        this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);\n    }   \n    return false;\n}",
+           "| bool highlightErrors" : "( Gee.HashMap<int,string> validate_res) {\n         \n    this.error_line = validate_res.size;\n\t\n    if (this.error_line < 1) {\n          return true;\n    }\n    var tlines = this.el.get_line_count ();\n    Gtk.TextIter iter;\n    var valiter = validate_res.map_iterator();\n    while (valiter.next()) {\n    \n//        print(\"get inter\\n\");\n        var eline = valiter.get_key();\n        if (eline > tlines) {\n            continue;\n        }\n        this.el.get_iter_at_line( out iter, eline);\n        //print(\"mark line\\n\");\n        this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);\n    }   \n    return false;\n}",
            "|   string toString" : "  () {\n    \n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_start_iter(out s);\n    this.el.get_end_iter(out e);\n    var ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n ",
-           "|   bool checkSyntax" : " () {\n \n   \n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    \n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return true;\n    }\n    \n   if (_this.file == null) {\n       return true;\n   }\n    var p = Palete.factory(_this.file.xtype);  // returns Roo | Gtk  | PlainFile \n    \n \n    if (_this.file.language == \"js\") {\n        \n        print(\"calling validate javascript\\n\"); \n  \t\treturn this.highlightErrors(p.validateJavascript(\n            str, \n             \"|\", // _this.key, \n            \"file\", //_this.ptype,\n            _this.file,\n            null\n        ));    \n        \n    }\n        \n        \n    print(\"calling validate vala\\n\");    \n    \n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
+           "|   bool checkSyntax" : " () {\n \n   \n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    \n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return true;\n    }\n    \n   if (_this.file == null) {\n       return true;\n   }\n    var p = Palete.factory(_this.file.xtype);  // returns Roo | Gtk  | PlainFile \n    \n \n    if (_this.file.language != \"js\") {\n\t\treturn;\n\t}\n\t\n        \n\n  \t\tvar res =  this.highlightErrors(p.validateJavascript(\n            str, \n             \"\", // _this.key, \n            \"file\", //_this.ptype,\n            _this.file,\n            null\n        ));    \n        \n    }\n        \n        \n    print(\"calling validate vala\\n\");    \n    \n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
            "* pack" : "set_buffer",
            "xtype" : "SourceBuffer",
            "$ xns" : "Gtk"
index e2147f1..382a996 100644 (file)
@@ -1324,7 +1324,7 @@ public class Xcls_WindowRooView : Object
         public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
                  
             this.error_line = validate_res.size;
-        
+               
             if (this.error_line < 1) {
                   return true;
             }
@@ -1379,12 +1379,15 @@ public class Xcls_WindowRooView : Object
             var p = Palete.factory(_this.file.xtype);  // returns Roo | Gtk  | PlainFile 
             
          
-            if (_this.file.language == "js") {
+            if (_this.file.language != "js") {
+                       return;
+               }
+               
                 
-                print("calling validate javascript\n"); 
-                       return this.highlightErrors(p.validateJavascript(
+        
+                       var res =  this.highlightErrors(p.validateJavascript(
                     str, 
-                     "|", // _this.key, 
+                     "", // _this.key, 
                     "file", //_this.ptype,
                     _this.file,
                     null