fix #7968 - language server support for syntax check and completion
[roobuilder] / src / Builder4 / ValaCompileErrors.bjs
index 3bf4b55..5e4aeb3 100644 (file)
@@ -3,12 +3,12 @@
  "gen_extended" : false,
  "items" : [
   {
-   "# GLib.ListStore notices" : "",
    "# Xcls_MainWindow window" : "",
    "$ xns" : "Gtk",
    "* ctor" : "new Gtk.Popover()",
    "Gtk.PositionType position" : "Gtk.PositionType.TOP",
    "bool autohide" : true,
+   "bool loaded" : false,
    "id" : "ValaCompileErrors",
    "int height_request" : 800,
    "int width_request" : 900,
                "* prop" : "model",
                "id" : "model",
                "xtype" : "TreeListModel"
+              },
+              {
+               "$ xns" : "Gtk",
+               "* prop" : "sorter",
+               "items" : [
+                {
+                 "$ xns" : "Gtk",
+                 "* prop" : "sorter",
+                 "items" : [
+                  {
+                   "$ xns" : "Gtk",
+                   "* prop" : "expression",
+                   "GLib.Type this_type" : "typeof(Palete.CompileError)",
+                   "string property_name" : "linemsg",
+                   "xtype" : "PropertyExpression"
+                  }
+                 ],
+                 "xtype" : "StringSorter"
+                }
+               ],
+               "xtype" : "TreeListRowSorter"
               }
              ],
              "xtype" : "SortListModel",
                "\t",
                "\t",
                "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
-               "\tlbl.label = np.line_msg;",
+               "\tlbl.label = np.linemsg;",
                "\t//lbl.tooltip_markup = np.to_property_option_tooltip();",
                "\t ",
                "    expand.set_hide_expander(  np.lines.n_items < 1);",
                "\texpand.set_list_row(lr);",
                " ",
                " \t// expand current file.",
-               " \tif (_this.window.windowstate.file.path == np.file.path) {",
-               " \t\tlr.expanded = true;",
-               "\t}",
+               " \t// this causes problems? - critical errors?",
+               " \t// maybe do it on show",
+               " \t//if (_this.window.windowstate.file.path == np.file.path &&",
+               " \t//\tnp.line < 0) {",
+               " \t//\tlr.expanded = true;",
+               " \t",
+               "\t//}",
                " \t ",
                " \t// bind image...",
                " \t",
              "\t}",
              "\t ",
              "\t ",
-             "    var fname  = ce.parent.file;",
+             "    var fname  = ce.file;",
              "  \tvar line = ce.line;  ",
-             "    GLib.debug(\"open %s @ %d\\n\", ce.parent.file.path, ce.line);",
+             "    GLib.debug(\"open %s @ %d\\n\", ce.file.path, ce.line);",
              "    ",
              "    ",
              "   var  bjsf = \"\";",
              "        _this.window.windowstate.fileViewOpen(jsr, true, line);",
              "        ",
              "        if (jsr.path == _this.window.windowstate.file.path) {",
-             "        \t_this.el.hide();",
-             "    \t}",
              "        ",
+             "    \t}",
+             "    \t_this.el.hide();",
              "        ",
              "        return;",
              "    ",
              "    }",
-             "    try {",
-             "\t\tvar pf = JsRender.JsRender.factory(\"PlainFile\", p, fname.path);",
-             "\t\t_this.window.windowstate.fileViewOpen(pf, true, line);",
-             "    } catch (JsRender.Error e) {}",
-             "    // try hiding the left nav..",
-             " ",
-             "    return;",
+             "  ",
+             "\tvar pf = p.getByPath(fname.path);",
+             "\t_this.el.hide();",
+             "\t_this.window.windowstate.fileViewOpen(pf, true, line);",
              "",
+             "    ",
              "}",
              ""
             ]
    ],
    "xtype" : "Popover",
    "| void show" : [
-    "( GLib.ListStore ls , Gtk.Widget onbtn) {",
-    "",
-    "    ",
+    "(   ) {",
+    "\tGLib.debug(\"errors  : show\");",
+    "\t",
+    "\tif (_this.model.el.get_n_items()  < 1) {",
+    "   ",
+    " \t    GLib.debug(\"errors  : none available\");",
+    "    \treturn;",
+    "\t}",
     " \t//this.el.present();",
     "    //this.el.popup();",
-    "    this.notices = ls;",
-    "   ",
+    "    ",
     "     //print(\"looking for %s\\n\", id);",
     "    // loop through parent childnre",
     "      ",
     "    ",
-    "      this.tree.el.hide(); //<< very important!!!",
+    "     ; //<< very important!!!",
     "      ",
     "   // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
     " ",
     "    var  w = win.get_width();",
     "    var h = win.get_height();",
     "",
-    "  ",
-    "     ",
+    "   ",
     "    // left tree = 250, editor area = 500?",
     "    ",
     "    // min 450?",
     "    if (new_w > (w-100)) {",
     "        new_w = w-100;",
     "    }",
+    "    GLib.debug(\"set size\");",
     "    this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
     " ",
     "",
     "\t//Gtk.Allocation rect;",
     "\t//onbtn.get_allocation(out rect);",
     "    //this.el.set_pointing_to(rect);",
-    "\tthis.el.present();",
+    "\t//this.el.present();",
+    "\t",
+    "\tGLib.debug(\"call popup\");",
     "    this.el.popup();",
+    "    // only need to load once.",
+    " \t//if (!this.loaded) {",
+    " \t\t ",
+    "\t\t//this.loaded = true;",
+    "\t //}",
+    "\t ",
+    "       ",
     "   ",
-    " ",
+    "   \t//if (expand != null) {",
+    "    //\t_this.compile_tree.el.expand_row(   store.get_path(expand) , true);",
+    "//\t}",
+    "    ",
+    " //   this.hpane.el.set_position( 0);",
+    "}",
+    ""
+   ],
+   "| void updateNotices" : [
+    "( GLib.ListStore? ls) {",
+    "\tGLib.debug(\"errors  : update\");",
+    "    if (ls == null || ls.get_n_items() < 1) {",
+    " \t    GLib.debug(\"errors  : none available\");",
+    "    \treturn;",
+    "\t}",
+    "\t",
+    "\tGLib.debug(\"Loading list into tree\");",
+    "\tthis.tree.el.hide();",
     "\tvar tm = new Gtk.TreeListModel(",
     "\t\tls, //..... << that's our store..",
     "\t\tfalse, // passthru",
     "\t\t\t return ((Palete.CompileError)item).lines;",
     "\t\t",
     "\t\t}",
+    "\t\t",
     "\t);",
     " ",
-    "    _this.model.el = tm;",
-    "    _this.sortmodel.el.set_model(tm);",
-    " ",
-    "         this.tree.el.show();   ",
-    "   ",
-    "   \t//if (expand != null) {",
-    "    //\t_this.compile_tree.el.expand_row(   store.get_path(expand) , true);",
-    "//\t}",
-    "    ",
-    " //   this.hpane.el.set_position( 0);",
-    "}",
-    ""
+    "\t_this.model.el = tm;",
+    "\t_this.sortmodel.el.set_model(tm);",
+    "\t this.tree.el.show();",
+    "}"
    ]
   }
  ],