fix #7968 - language server support for syntax check and completion
[roobuilder] / src / Builder4 / ValaCompileErrors.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# Xcls_MainWindow window" : "",
7    "$ xns" : "Gtk",
8    "* ctor" : "new Gtk.Popover()",
9    "Gtk.PositionType position" : "Gtk.PositionType.TOP",
10    "bool autohide" : true,
11    "bool loaded" : false,
12    "id" : "ValaCompileErrors",
13    "int height_request" : 800,
14    "int width_request" : 900,
15    "items" : [
16     {
17      "$ xns" : "Gtk",
18      "* pack" : "set_child",
19      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
20      "bool hexpand" : false,
21      "gboolean homogeneous" : false,
22      "id" : "compile_view",
23      "items" : [
24       {
25        "$ xns" : "Gtk",
26        "* init" : [
27         "{",
28         " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
29         " ",
30         "",
31         "}",
32         ""
33        ],
34        "items" : [
35         {
36          "$ xns" : "Gtk",
37          "* pack" : "set_child",
38          "bool hexpand" : true,
39          "bool vexpand" : true,
40          "id" : "tree",
41          "items" : [
42           {
43            "$ xns" : "Gtk",
44            "* prop" : "model",
45            "id" : "selmodel",
46            "items" : [
47             {
48              "$ xns" : "Gtk",
49              "* prop" : "model",
50              "id" : "sortmodel",
51              "items" : [
52               {
53                "$ xns" : "Gtk",
54                "* ctor" : [
55                 "new Gtk.TreeListModel(",
56                 "    new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..",
57                 "    false, // passthru",
58                 "    false, // autexpand",
59                 "    (item) => {",
60                 "    ",
61                 "    \t ",
62                 "    \t return ((Palete.CompileError)item).lines;",
63                 "    ",
64                 "    }",
65                 "    ",
66                 "    ",
67                 ")"
68                ],
69                "* prop" : "model",
70                "id" : "model",
71                "xtype" : "TreeListModel"
72               },
73               {
74                "$ xns" : "Gtk",
75                "* prop" : "sorter",
76                "items" : [
77                 {
78                  "$ xns" : "Gtk",
79                  "* prop" : "sorter",
80                  "items" : [
81                   {
82                    "$ xns" : "Gtk",
83                    "* prop" : "expression",
84                    "GLib.Type this_type" : "typeof(Palete.CompileError)",
85                    "string property_name" : "linemsg",
86                    "xtype" : "PropertyExpression"
87                   }
88                  ],
89                  "xtype" : "StringSorter"
90                 }
91                ],
92                "xtype" : "TreeListRowSorter"
93               }
94              ],
95              "xtype" : "SortListModel",
96              "| Json.Object getNodeAt" : [
97               "(uint row) {",
98               "",
99               "   var tr = (Gtk.TreeListRow)this.el.get_item(row);",
100               "   ",
101               "  ",
102               "  // GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
103               "  \t",
104               "   ",
105               "   return (Json.Object)tr.get_item();",
106               "\t ",
107               "}"
108              ]
109             }
110            ],
111            "xtype" : "SingleSelection",
112            "| Json.Object getNodeAt" : [
113             "(uint row) {",
114             "",
115             "   var tr = (Gtk.TreeListRow)this.el.get_item(row);",
116             "   ",
117             "   var a = tr.get_item();;   ",
118             "   GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
119             "    ",
120             "   return (Json.Object)tr.get_item();",
121             "\t ",
122             "}"
123            ]
124           },
125           {
126            "$ xns" : "Gtk",
127            "* pack" : "append_column",
128            "bool expand" : true,
129            "bool resizable" : true,
130            "items" : [
131             {
132              "$ xns" : "Gtk",
133              "* prop" : "factory",
134              "listeners" : {
135               "bind" : [
136                "(listitem) => {",
137                "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
138                "\t",
139                "\t",
140                "\t",
141                "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
142                "\tvar expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();",
143                "\t  ",
144                " ",
145                "\tvar lbl = (Gtk.Label) expand.child;",
146                "\t",
147                "\t if (lbl.label != \"\") { // do not update",
148                "\t \treturn;",
149                " \t}",
150                "\t",
151                "",
152                "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
153                "\tvar np = (Palete.CompileError) lr.get_item();",
154                "\t",
155                "\t",
156                "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
157                "\tlbl.label = np.linemsg;",
158                "\t//lbl.tooltip_markup = np.to_property_option_tooltip();",
159                "\t ",
160                "    expand.set_hide_expander(  np.lines.n_items < 1);",
161                "\texpand.set_list_row(lr);",
162                " ",
163                " \t// expand current file.",
164                " \t// this causes problems? - critical errors?",
165                " \t// maybe do it on show",
166                " \t//if (_this.window.windowstate.file.path == np.file.path &&",
167                " \t//\tnp.line < 0) {",
168                " \t//\tlr.expanded = true;",
169                " \t",
170                "\t//}",
171                " \t ",
172                " \t// bind image...",
173                " \t",
174                "}",
175                ""
176               ],
177               "setup" : [
178                "(listitem) => {",
179                "\t",
180                "\tvar expand = new Gtk.TreeExpander();",
181                "\t ",
182                "\texpand.set_indent_for_depth(true);",
183                "\texpand.set_indent_for_icon(true);",
184                "\t ",
185                "\tvar lbl = new Gtk.Label(\"\");",
186                "\tlbl.use_markup = true;",
187                "\t",
188                "\t",
189                " \tlbl.justify = Gtk.Justification.LEFT;",
190                " \tlbl.xalign = 0;",
191                "",
192                " ",
193                "\texpand.set_child(lbl);",
194                "\t((Gtk.ListItem)listitem).set_child(expand);",
195                "\t((Gtk.ListItem)listitem).activatable = false;",
196                "}",
197                ""
198               ]
199              },
200              "xtype" : "SignalListItemFactory"
201             }
202            ],
203            "string title" : "Compile Result",
204            "xtype" : "ColumnViewColumn"
205           },
206           {
207            "$ xns" : "Gtk",
208            "listeners" : {
209             "pressed" : [
210              "(n_press, x, y) => {",
211              "\t",
212              "\tif (n_press < 2) { /// doubleclick?",
213              "\t\treturn;",
214              "\t}",
215              " ",
216              "\t",
217              "\t",
218              "\t// use selection?!",
219              "\tvar tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;",
220              "\t//GLib.debug(\"SELECTED = %s\", tr.item.get_type().name());",
221              "\tvar ce = (Palete.CompileError) tr.item;",
222              "",
223              "\tif (ce.line < 0) {",
224              "\t\t// did not click on a line.",
225              "\t\treturn;",
226              "\t}",
227              "\t ",
228              "\t ",
229              "    var fname  = ce.file;",
230              "  \tvar line = ce.line;  ",
231              "    GLib.debug(\"open %s @ %d\\n\", ce.file.path, ce.line);",
232              "    ",
233              "    ",
234              "   var  bjsf = \"\";",
235              "    try {             ",
236              "       var  regex = new Regex(\"\\\\.vala$\");",
237              "    ",
238              "     ",
239              "        bjsf = regex.replace(fname.path,fname.path.length , 0 , \".bjs\");",
240              "     } catch (GLib.RegexError e) {",
241              "        return;",
242              "    }   ",
243              "    var p = _this.window.project;",
244              "        ",
245              "        ",
246              "        ",
247              "    var jsr = p.getByPath(bjsf);",
248              "    if (jsr != null) {",
249              "        _this.window.windowstate.fileViewOpen(jsr, true, line);",
250              "        ",
251              "        if (jsr.path == _this.window.windowstate.file.path) {",
252              "        ",
253              "    \t}",
254              "    \t_this.el.hide();",
255              "        ",
256              "        return;",
257              "    ",
258              "    }",
259              "  ",
260              "\tvar pf = p.getByPath(fname.path);",
261              "\t_this.el.hide();",
262              "\t_this.window.windowstate.fileViewOpen(pf, true, line);",
263              "",
264              "    ",
265              "}",
266              ""
267             ]
268            },
269            "uint button" : 0,
270            "xtype" : "GestureClick"
271           }
272          ],
273          "xtype" : "ColumnView"
274         }
275        ],
276        "xtype" : "ScrolledWindow"
277       }
278      ],
279      "xtype" : "Box"
280     }
281    ],
282    "xtype" : "Popover",
283    "| void show" : [
284     "(   ) {",
285     "\tGLib.debug(\"errors  : show\");",
286     "\t",
287     "\tif (_this.model.el.get_n_items()  < 1) {",
288     "   ",
289     " \t    GLib.debug(\"errors  : none available\");",
290     "    \treturn;",
291     "\t}",
292     " \t//this.el.present();",
293     "    //this.el.popup();",
294     "    ",
295     "     //print(\"looking for %s\\n\", id);",
296     "    // loop through parent childnre",
297     "      ",
298     "    ",
299     "     ; //<< very important!!!",
300     "      ",
301     "   // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
302     " ",
303     "    var win = this.window.el;",
304     "    var  w = win.get_width();",
305     "    var h = win.get_height();",
306     "",
307     "   ",
308     "    // left tree = 250, editor area = 500?",
309     "    ",
310     "    // min 450?",
311     "    var new_w = int.min(650, w-100);",
312     "    if (new_w > (w-100)) {",
313     "        new_w = w-100;",
314     "    }",
315     "    GLib.debug(\"set size\");",
316     "    this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
317     " ",
318     "",
319     "   // this.el.set_relative_to(onbtn);",
320     "\t//Gtk.Allocation rect;",
321     "\t//onbtn.get_allocation(out rect);",
322     "    //this.el.set_pointing_to(rect);",
323     "\t//this.el.present();",
324     "\t",
325     "\tGLib.debug(\"call popup\");",
326     "    this.el.popup();",
327     "    // only need to load once.",
328     " \t//if (!this.loaded) {",
329     " \t\t ",
330     "\t\t//this.loaded = true;",
331     "\t //}",
332     "\t ",
333     "       ",
334     "   ",
335     "   \t//if (expand != null) {",
336     "    //\t_this.compile_tree.el.expand_row(   store.get_path(expand) , true);",
337     "//\t}",
338     "    ",
339     " //   this.hpane.el.set_position( 0);",
340     "}",
341     ""
342    ],
343    "| void updateNotices" : [
344     "( GLib.ListStore? ls) {",
345     "\tGLib.debug(\"errors  : update\");",
346     "    if (ls == null || ls.get_n_items() < 1) {",
347     " \t    GLib.debug(\"errors  : none available\");",
348     "    \treturn;",
349     "\t}",
350     "\t",
351     "\tGLib.debug(\"Loading list into tree\");",
352     "\tthis.tree.el.hide();",
353     "\tvar tm = new Gtk.TreeListModel(",
354     "\t\tls, //..... << that's our store..",
355     "\t\tfalse, // passthru",
356     "\t\tfalse, // autexpand",
357     "\t\t(item) => {",
358     "\t\t",
359     "\t\t\t return ((Palete.CompileError)item).lines;",
360     "\t\t",
361     "\t\t}",
362     "\t\t",
363     "\t);",
364     " ",
365     "\t_this.model.el = tm;",
366     "\t_this.sortmodel.el.set_model(tm);",
367     "\t this.tree.el.show();",
368     "}"
369    ]
370   }
371  ],
372  "name" : "ValaCompileErrors"
373 }