b64c17e1a908c03d1bee41ee3e896e59832124b6
[roobuilder] / src / Builder4 / Editor.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# GtkSource.SearchContext searchcontext" : "null",
7    "# JsRender.JsRender? file" : "null",
8    "# JsRender.Node node" : "null",
9    "# JsRender.NodeProp? prop" : "null",
10    "# Xcls_MainWindow window" : "null",
11    "# bool dirty" : false,
12    "# bool pos" : false,
13    "# int last_error_counter" : 0,
14    "# int pos_root_x" : "",
15    "# int pos_root_y" : "",
16    "# string activeEditor" : "\"\"",
17    "$ homogeneous" : false,
18    "$ xns" : "Gtk",
19    "@ void save" : "()",
20    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21    "bool hexpand" : true,
22    "bool vexpand" : true,
23    "int last_search_end" : 0,
24    "items" : [
25     {
26      "$ xns" : "Gtk",
27      "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
28      "bool shrink_end_child" : false,
29      "int width_request" : 200,
30      "items" : [
31       {
32        "$ xns" : "Gtk",
33        "* prop" : "start_child",
34        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
35        "int spacing" : 0,
36        "items" : [
37         {
38          "$ homogeneous" : false,
39          "$ xns" : "Gtk",
40          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
41          "bool hexpand" : false,
42          "bool vexpand" : false,
43          "items" : [
44           {
45            "$ xns" : "Gtk",
46            "bool vexpand" : true,
47            "id" : "save_button",
48            "label" : "Save",
49            "listeners" : {
50             "clicked" : [
51              " () => { ",
52              "    _this.saveContents();",
53              "}",
54              "  "
55             ]
56            },
57            "xtype" : "Button"
58           },
59           {
60            "$ xns" : "Gtk",
61            "Gtk.Justification justify" : "Gtk.Justification.LEFT",
62            "bool hexpand" : true,
63            "float xalign" : 0,
64            "id" : "helper",
65            "int margin_end" : 4,
66            "int margin_start" : 4,
67            "xtype" : "Label",
68            "| void setHelp" : [
69             "(Lsp.Hover? help) {",
70             "\tif (help == null || help.contents == null",
71             "\t\t|| help.contents.size < 1) {",
72             "\t\tthis.el.set_text(\"\");",
73             "\t\treturn;",
74             "\t}",
75             "\tvar sig = help.contents.get(0).value.split(\" \");",
76             "\tstring[] str = {};",
77             "\tfor(var i =0; i < sig.length; i++) {",
78             "\t",
79             "\t\tswitch(sig[i]) {",
80             "\t\t\tcase \"public\":",
81             "\t\t\tcase \"private\":",
82             "\t\t\tcase \"protected\":",
83             "\t\t\tcase \"async\":",
84             "\t\t\tcase \"class\":",
85             "\t\t\tcase \"{\":",
86             "\t\t\tcase \"}\":",
87             "\t\t\tcase \"(\":",
88             "\t\t\tcase \")\":",
89             "\t\t\t",
90             "\t\t\t\tstr += sig[i];",
91             "\t\t\t\tcontinue;",
92             "\t\t\t\t",
93             "\t\t\t\t",
94             "\t\t\tdefault:",
95             "\t",
96             "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
97             "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
98             "\t\t\t\t\t+\"</span>\");",
99             "\t\t\tcontinue;",
100             "\t\t}",
101             "\t}",
102             "\tif (help.contents.size > 1) {",
103             "\t\tsig += (\"\\n\\n\"  + help.contents[1].value);",
104             "\t}",
105             "\t",
106             "\tthis.el.set_markup(string.joinv(\" \",str));",
107             "\t",
108             "}"
109            ]
110           },
111           {
112            "$ xns" : "Gtk",
113            "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
114            "* init" : [
115             "{",
116             "\t//this.el.set_range(6,30);",
117             " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
118             " \tBuilderApplication.settings.editor_font_size_updated.connect(",
119             " \t\t() => {",
120             " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
121             " \t\t//\tGLib.debug(\"update range\");",
122             " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
123             " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
124             " \t\t}",
125             "\t);",
126             "\t",
127             " ",
128             "}",
129             ""
130            ],
131            "Gtk.Align halign" : "Gtk.Align.END",
132            "bool draw_value" : false,
133            "bool has_origin" : true,
134            "bool sensitive" : true,
135            "int digits" : 0,
136            "int width_request" : 150,
137            "listeners" : {
138             "change_value" : [
139              "(st, val ) => {",
140              "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
141              "\t\treturn false;",
142              "\t}",
143              "  \tBuilderApplication.settings.editor_font_size = val;",
144              " \treturn false;",
145              "}"
146             ]
147            },
148            "xtype" : "Scale"
149           },
150           {
151            "$ xns" : "Gtk",
152            "Gtk.Align halign" : "Gtk.Align.END",
153            "id" : "close_btn",
154            "items" : [
155             {
156              "$ xns" : "Gtk",
157              "* prop" : "child",
158              "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
159              "string icon_name" : "window-close",
160              "xtype" : "Image"
161             }
162            ],
163            "listeners" : {
164             "clicked" : [
165              " () => { ",
166              "    _this.saveContents();",
167              "    _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
168              "}",
169              "  "
170             ]
171            },
172            "string icon_name" : "window-close",
173            "xtype" : "Button"
174           }
175          ],
176          "xtype" : "Box"
177         },
178         {
179          "$ xns" : "Gtk",
180          "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
181          "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
182          "bool overlay_scrolling" : false,
183          "bool vexpand" : true,
184          "id" : "RightEditor",
185          "items" : [
186           {
187            "# Gtk.CssProvider css" : "null",
188            "$ gboolean auto_indent" : true,
189            "$ xns" : "GtkSource",
190            "* init" : [
191             "",
192             " ",
193             "\t",
194             " ",
195             " ",
196             "this.el.completion.add_provider(",
197             "\tnew Palete.CompletionProvider(_this)",
198             ");",
199             "",
200             "// hover seems pretty useless.. - ??",
201             "//var hover = this.el.get_hover();",
202             "//hover.add_provider(new Palete.HoverProvider(_this));",
203             "",
204             "//this.el.completion.unblock_interactive();",
205             "this.el.completion.select_on_show = true; // select",
206             "//this.el.completion.remember_info_visibility\t = true;",
207             "",
208             "",
209             "var attrs = new GtkSource.MarkAttributes();",
210             "",
211             "attrs.set_icon_name ( \"process-stop\");    ",
212             "attrs.query_tooltip_text.connect(( mark) => {",
213             "     GLib.debug(\"tooltip query? %s\", mark.name);",
214             "    return strdup( mark.name);",
215             "});",
216             " attrs.query_tooltip_markup.connect(( mark) => {",
217             "     GLib.debug(\"tooltip query? %s\", mark.name);",
218             "    return strdup( mark.name);",
219             "});",
220             "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
221             "attrs.ref();",
222             "",
223             "",
224             "var wattrs = new GtkSource.MarkAttributes();",
225             "wattrs.set_icon_name ( \"process-stop\");    ",
226             "wattrs.query_tooltip_text.connect(( mark) => {",
227             "     GLib.debug(\"tooltip query? %s\", mark.name);",
228             "    return strdup(mark.name);",
229             "});",
230             "wattrs.query_tooltip_markup.connect(( mark) => {",
231             "     GLib.debug(\"tooltip query? %s\", mark.name);",
232             "    return strdup(mark.name);",
233             "});",
234             "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
235             "wattrs.ref();",
236             "",
237             " ",
238             "var dattrs = new GtkSource.MarkAttributes();",
239             " ",
240             "dattrs.set_icon_name ( \"process-stop\"); ",
241             "",
242             "dattrs.query_tooltip_text.connect(( mark) => {",
243             "\tGLib.debug(\"tooltip query? %s\", mark.name);",
244             "    return strdup(mark.name);",
245             "});",
246             "//dattrs.query_tooltip_markup.connect(( mark) => {",
247             "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
248             " //   return strdup(mark.name);",
249             "//});",
250             "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
251             "dattrs.ref();    ",
252             "",
253             " this.el.get_space_drawer().set_matrix(null);",
254             " this.el.get_space_drawer().set_types_for_locations( ",
255             "\tGtkSource.SpaceLocationFlags.ALL,",
256             "\tGtkSource.SpaceTypeFlags.ALL",
257             ");",
258             "this.el.get_space_drawer().set_enable_matrix(true);",
259             ""
260            ],
261            "* prop" : "child",
262            "bool has_tooltip" : true,
263            "bool hexpand" : true,
264            "bool insert_spaces_instead_of_tabs" : true,
265            "bool vexpand" : true,
266            "boolean show_line_marks" : true,
267            "boolean show_line_numbers" : true,
268            "css_classes" : "{ \"code-editor\" }",
269            "gboolean highlight_current_line" : true,
270            "id" : "view",
271            "indent_width" : 4,
272            "items" : [
273             {
274              "$ Gee.HashMap<int,string>? xmarks" : "null",
275              "$ xns" : "GtkSource",
276              "$ xtype" : "Buffer",
277              "* init" : [
278               "",
279               "var buf = this.el;",
280               "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
281               "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
282               "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
283               "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
284               "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
285               "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
286               "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
287               "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
288               "",
289               "",
290               "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
291               "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
292               "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
293               "",
294               "",
295               ""
296              ],
297              "* prop" : "buffer",
298              "bool check_queued" : false,
299              "bool enable_undo" : true,
300              "bool highlight_matching_brackets" : true,
301              "bool highlight_syntax" : true,
302              "id" : "buffer",
303              "int error_line" : "-1",
304              "listeners" : {
305               "changed" : [
306                " () => {",
307                "    // check syntax??",
308                "    // ??needed..??",
309                "    _this.save_button.el.sensitive = true;",
310                "    print(\"EDITOR CHANGED\");",
311                "    this.checkSyntax();",
312                "   ",
313                "    _this.dirty = true;",
314                "",
315                "    // this.get('/LeftPanel.model').changed(  str , false);",
316                "    return ;",
317                "}",
318                ""
319               ],
320               "cursor_moved" : [
321                "( ) => {",
322                "",
323                "\tGtk.TextIter iter;",
324                "\tthis.el.get_iter_at_offset (",
325                "\t\t\tout iter, this.el.cursor_position);",
326                "",
327                "\t_this.navigation.updateSelectedLine(",
328                "\t\t\t(uint)iter.get_line(),",
329                "\t\t\t(uint)iter.get_line_offset()",
330                "\t\t);",
331                "\tthis.showHelp(iter);",
332                "",
333                "}",
334                ""
335               ]
336              },
337              "| bool OLDhighlightErrorsJson" : [
338               "(string type, Json.Object obj) {",
339               "\tGtk.TextIter start;",
340               "\tGtk.TextIter end;     ",
341               "\tthis.el.get_bounds (out start, out end);",
342               "",
343               "\tthis.el.remove_source_marks (start, end, type);",
344               "\tGLib.debug(\"highlight errors\");\t\t ",
345               "",
346               "\t // we should highlight other types of errors..",
347               "",
348               "\tif (!obj.has_member(type)) {",
349               "\t\tGLib.debug(\"Return has no errors\\n\");",
350               "\t\treturn true;",
351               "\t}",
352               "",
353               "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
354               "\t\t&&",
355               "\t\t_this.window.windowstate.state != WindowState.State.CODE",
356               "\t\t) {",
357               "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
358               "\t\t",
359               "\t\treturn true;",
360               "\t} ",
361               "",
362               "\t//this.marks = new Gee.HashMap<int,string>();",
363               "\tvar err = obj.get_object_member(type);",
364               " ",
365               "\tif (_this.file == null) {",
366               "\t\tGLib.debug(\"file is null?\");",
367               "\t\treturn true;",
368               "",
369               "\t}",
370               "\tvar valafn = _this.file.path;",
371               "",
372               "\tif (_this.file.xtype != \"PlainFile\") {",
373               "",
374               "\t\tvalafn = \"\";",
375               "\t\ttry {             ",
376               "\t\t\tvar  regex = new Regex(\"\\\\.bjs$\");",
377               "\t\t\t// should not happen",
378               "\t      \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
379               "\t\t} catch (GLib.RegexError e) {",
380               "\t\t\treturn true;",
381               "\t\t}   ",
382               "",
383               "",
384               "",
385               "\t}",
386               "\tif (!err.has_member(valafn)) {",
387               "\t\tGLib.debug(\"File path has no errors\");",
388               "\t\treturn  true;",
389               "\t}",
390               "",
391               "\tvar lines = err.get_object_member(valafn);",
392               "\t",
393               "\tvar offset = 1;",
394               "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
395               "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
396               "\t}",
397               "",
398               "",
399               "\tvar tlines = this.el.get_line_count () +1;",
400               "\t",
401               "\tif (_this.prop != null) {",
402               "\t",
403               "\t\ttlines = _this.prop.end_line + 1;",
404               "\t\toffset = _this.prop.start_line + 1;",
405               "\t",
406               "\t}",
407               "\t",
408               "",
409               "",
410               "\tlines.foreach_member((obj, line, node) => {",
411               "\t\t",
412               "\t     Gtk.TextIter iter;",
413               "//        print(\"get inter\\n\");",
414               "\t    var eline = int.parse(line) - offset;",
415               "\t    GLib.debug(\"GOT ERROR on line %s -- converted to %d  (offset = %d)\\n\", line,eline, offset);",
416               "\t    ",
417               "\t    ",
418               "\t    if (eline > tlines || eline < 0) {",
419               "\t        return;",
420               "\t    }",
421               "\t   ",
422               "\t    ",
423               "\t    this.el.get_iter_at_line( out iter, eline);",
424               "\t    //print(\"mark line\\n\");",
425               "\t    var msg  = \"\";",
426               "\t    var ar = lines.get_array_member(line);",
427               "\t    for (var i = 0 ; i < ar.get_length(); i++) {",
428               "\t    \tif (ar.get_string_element(i) == \"Success\") {",
429               "\t    \t\tcontinue;",
430               "    \t\t}",
431               "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
432               "\t\t\tmsg += ar.get_string_element(i);",
433               "\t\t}",
434               "\t\tif (msg == \"\") {",
435               "\t\t\treturn;",
436               "\t\t}",
437               "\t\tmsg = \"Line: %d\".printf(eline+1) +  \" \" + msg;",
438               "\t    this.el.create_source_mark(msg, type, iter);",
439               "\t    GLib.debug(\"set line %d to %m\", eline, msg);",
440               "\t   // this.marks.set(eline, msg);",
441               "\t} );",
442               "\treturn false;",
443               "",
444               "",
445               "",
446               "",
447               "",
448               "\t}",
449               ""
450              ],
451              "| bool checkSyntax" : [
452               " () {",
453               " ",
454               "    ",
455               "    var str = this.toString();",
456               "    ",
457               "    // needed???",
458               "    if (this.error_line > 0) {",
459               "         Gtk.TextIter start;",
460               "         Gtk.TextIter end;     ",
461               "        this.el.get_bounds (out start, out end);",
462               "",
463               "        this.el.remove_source_marks (start, end, null);",
464               "    }",
465               "    if (str.length < 1) {",
466               "        print(\"checkSyntax - empty string?\\n\");",
467               "        return true;",
468               "    }",
469               "    ",
470               "    // bit presumptiona",
471               "    if (_this.file.xtype == \"PlainFile\") {",
472               "    ",
473               "        // assume it's gtk...",
474               "         var  oldcode =_this.file.toSource();",
475               "        _this.file.setSource(str);",
476               "\t    BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
477               "    \t_this.file.getLanguageServer().document_change(_this.file);",
478               "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
479               "        _this.file.setSource(oldcode);",
480               "        ",
481               "\t\t ",
482               "        return true;",
483               "    ",
484               "    }",
485               "   if (_this.file == null) {",
486               "       return true;",
487               "   }",
488               " ",
489               "    ",
490               "",
491               "      ",
492               "     ",
493               "    GLib.debug(\"calling validate\");    ",
494               "    // clear the buttons.",
495               " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
496               "\t\treturn true ;",
497               "\t}",
498               "\tvar oldcode  = _this.prop.val;",
499               "\t",
500               "\t_this.prop.val = str;",
501               "\t_this.node.updated_count++;",
502               "    _this.file.getLanguageServer().document_change(_this.file);",
503               "    _this.node.updated_count++;",
504               "    _this.prop.val = oldcode;",
505               "    ",
506               "    ",
507               "    //print(\"done mark line\\n\");",
508               "     ",
509               "    return true; // at present allow saving - even if it's invalid..",
510               "}",
511               ""
512              ],
513              "| bool highlightErrors" : [
514               "( Gee.HashMap<int,string> validate_res) {",
515               "         ",
516               "\tthis.error_line = validate_res.size;",
517               "",
518               "\tif (this.error_line < 1) {",
519               "\t\treturn true;",
520               "\t}",
521               "\tvar tlines = this.el.get_line_count ();",
522               "\tGtk.TextIter iter;",
523               "\tvar valiter = validate_res.map_iterator();",
524               "\twhile (valiter.next()) {",
525               "",
526               "\t//        print(\"get inter\\n\");",
527               "\t\tvar eline = valiter.get_key();",
528               "\t\tif (eline > tlines) {",
529               "\t\t\tcontinue;",
530               "\t\t}",
531               "\t\tthis.el.get_iter_at_line( out iter, eline);",
532               "\t\t//print(\"mark line\\n\");",
533               "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
534               "\t}   ",
535               "\treturn false;",
536               "}"
537              ],
538              "| string toString" : [
539               "  () {",
540               "    ",
541               "    Gtk.TextIter s;",
542               "    Gtk.TextIter e;",
543               "    this.el.get_start_iter(out s);",
544               "    this.el.get_end_iter(out e);",
545               "    var ret = this.el.get_text(s,e,true);",
546               "    //print(\"TO STRING? \" + ret);",
547               "    return ret;",
548               "}",
549               " "
550              ],
551              "| void showHelp" : [
552               "(Gtk.TextIter iter) {",
553               "\tvar back = iter.copy();",
554               "\tback.backward_char();",
555               "\t",
556               "\tvar forward = iter.copy();",
557               "\tforward.forward_char();",
558               "\t",
559               "\t// what's the character at the iter?",
560               "\tvar str = back.get_text(iter);",
561               "\tstr += iter.get_text(forward);",
562               "\tif (str.strip().length < 1) {",
563               "\t\treturn;",
564               "\t}",
565               "\tvar offset = iter.get_line_offset();",
566               "\tvar line = iter.get_line();",
567               "\tif (_this.prop != null) {",
568               "\t\t\t\t// ",
569               "\t\tline += _this.prop.start_line ; ",
570               "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
571               "\t\toffset += _this.node.node_pad.length;",
572               "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
573               "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
574               "\t\t\toffset += 2;",
575               "\t\t}",
576               "\t} ",
577               "\t",
578               "\tvar ls = _this.file.getLanguageServer();",
579               "\tls.hover.begin(",
580               "\t\t_this.file, line, offset,",
581               "\t\t( a, o)  => {",
582               "\t\t\ttry {",
583               "\t\t\t\tvar res = ls.hover.end(o );",
584               "\t\t\t",
585               "\t\t\t\t_this.helper.setHelp(res);",
586               "\t\t\t} catch (GLib.Error e) {",
587               "\t\t\t\t// noop..",
588               "\t\t\t}",
589               "\t\t});",
590               "}\t",
591               "\t\t ",
592               ""
593              ]
594             },
595             {
596              "# bool is_control" : false,
597              "$ xns" : "Gtk",
598              "id" : "keystate",
599              "listeners" : {
600               "key_pressed" : [
601                "(keyval, keycode, state) => {",
602                "",
603                " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
604                " \t\tthis.is_control = true;",
605                "\t}",
606                "\treturn false;",
607                "}",
608                ""
609               ],
610               "key_released" : [
611                "(keyval, keycode, state) => {",
612                "",
613                " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
614                " \t\tthis.is_control = false;",
615                "\t}",
616                "    if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
617                "        GLib.debug(\"SAVE: ctrl-S  pressed\");",
618                "        _this.saveContents();",
619                "        return;",
620                "    }",
621                "    ",
622                "    if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
623                "\t    GLib.debug(\"SAVE: ctrl-g  pressed\");",
624                "\t\t_this.forwardSearch(true);",
625                "\t    return;",
626                "\t}",
627                "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
628                "\t    GLib.debug(\"SAVE: ctrl-f  pressed\");",
629                "\t\t_this.search_entry.el.grab_focus();",
630                "\t\t_this.search_entry.el.select_region(0,-1);",
631                "\t    return;",
632                "\t}",
633                "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
634                "\t\t_this.view.el.show_completion();",
635                "\t}",
636                "\t",
637                "\tGtk.TextIter iter;",
638                "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position);  ",
639                "\tvar line  = iter.get_line();",
640                "\tvar offset = iter.get_line_offset();",
641                "\tGLib.debug(\"line  %d  off %d\", line ,offset);",
642                "\tif (_this.prop != null) {",
643                "\t\tline += _this.prop.start_line + 1; // i think..",
644                "\t\toffset += 12; // should probably be 8 without namespaced ",
645                "\t\tGLib.debug(\"guess line  %d  off %d\", line ,offset);",
646                "\t} ",
647                "    //_this.view.el.show_completion();",
648                "   // print(event.key.keyval)",
649                "    ",
650                "    ",
651                "    return;",
652                " ",
653                " ",
654                "}",
655                ""
656               ]
657              },
658              "xtype" : "EventControllerKey"
659             },
660             {
661              "# double distance" : "0.0f",
662              "$ xns" : "Gtk",
663              "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
664              "listeners" : {
665               "scroll" : [
666                "(dx, dy) => {",
667                "\tif (!_this.keystate.is_control) {",
668                "\t\treturn false;",
669                "\t}",
670                "\t //GLib.debug(\"scroll %f\",  dy);",
671                "\t",
672                "\tthis.distance += dy;",
673                "\t",
674                "\t//GLib.debug(\"scroll %f / %f\",  dy, this.distance);",
675                " ",
676                "\t if (this.distance < -1) {",
677                " ",
678                "\t\tBuilderApplication.settings.editor_font_size ++;",
679                "\t\tthis.distance = 0;",
680                "\t}",
681                "\tif (this.distance > 1) {",
682                "\t\tBuilderApplication.settings.editor_font_size --;",
683                "\t\tthis.distance = 0;",
684                "\t}",
685                "\t ",
686                "\treturn true;",
687                "}",
688                ""
689               ]
690              },
691              "xtype" : "EventControllerScroll"
692             },
693             {
694              "$ xns" : "Gtk",
695              "listeners" : {
696               "pressed" : [
697                "(n_press, x, y) => {",
698                "\tGtk.TextIter iter;",
699                "\tint  buffer_x, buffer_y;",
700                "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
701                "\t",
702                "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
703                "\t\t(int)x - gut.get_width(),  (int)y,",
704                "  \t\tout  buffer_x, out  buffer_y);",
705                "\t_this.view.el.get_iter_at_location (out  iter,  ",
706                "\t\t\tbuffer_x,  buffer_y);;",
707                "\t",
708                "\t",
709                "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
710                "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
711                "\t) { ",
712                "\t\treturn ;",
713                "\t}",
714                "\t_this.buffer.showHelp(iter);",
715                "\t ",
716                "\t\t ",
717                " ",
718                "}",
719                ""
720               ]
721              },
722              "xtype" : "GestureClick"
723             }
724            ],
725            "listeners" : {
726             "query_tooltip" : [
727              "(x, y, keyboard_tooltip, tooltip) => {",
728              "\t",
729              "\t//GLib.debug(\"query tooltip\");",
730              "\tGtk.TextIter iter;",
731              "\tint trailing;",
732              "\t",
733              "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
734              "\t",
735              "\t// I think this is problematic - if it's compliing  / updating at same time as query.",
736              "\t",
737              "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
738              "\t//\treturn false;",
739              "\t//}",
740              "\t",
741              "\tthis.el.get_iter_at_position (out iter, out trailing,  x,  y + yoff);",
742              "\t ",
743              "\tvar l = iter.get_line();",
744              "",
745              "\t",
746              "\t ",
747              "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
748              "\tif (l < 0) {",
749              "",
750              "\t\treturn false;",
751              "\t}",
752              "\t/*",
753              "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
754              "\t\tGLib.debug(\"line %d setting tip to %s\", l,  _this.buffer.marks.get(l));",
755              "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
756              "\t\treturn true;",
757              "\t}",
758              " ",
759              "\treturn false;",
760              "\t*/",
761              "\t",
762              "\t  ",
763              "\t// this crashes?? - not sure why.",
764              "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
765              "\tif (marks.is_empty()) {",
766              "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
767              "\t}",
768              "\tif (marks.is_empty()) {",
769              "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
770              "\t}",
771              "\t",
772              "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
773              "\tvar str = \"\";",
774              "\tmarks.@foreach((m) => { ",
775              "\t\t//GLib.debug(\"got mark %s\", m.name);",
776              "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
777              "\t});",
778              "\t// true if there is a mark..",
779              "\tif (str.length > 0 ) {",
780              "\t\ttooltip.set_text( str );",
781              "\t}",
782              "\treturn str.length > 0 ? true : false;",
783              "\t ",
784              "}",
785              ""
786             ]
787            },
788            "string name" : "editor-view",
789            "uint tab_width" : 4,
790            "xtype" : "View",
791            "| void load" : [
792             " (string str) {",
793             "",
794             "// show the help page for the active node..",
795             "   //this.get('/Help').show();",
796             " ",
797             "  // this.get('/BottomPane').el.set_current_page(0);",
798             "  \tGLib.debug(\"load called - Reset undo buffer\");",
799             "  \t",
800             "    var buf = (GtkSource.Buffer)this.el.get_buffer();",
801             "    buf.begin_irreversible_action();",
802             "    buf.set_text(str, str.length);",
803             "    buf.end_irreversible_action();",
804             "    ",
805             "    var lm = GtkSource.LanguageManager.get_default();",
806             "    var lang = \"vala\";",
807             "    if (_this.file != null) {",
808             "         lang = _this.file.language;",
809             "    }",
810             "    print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
811             "    var lg = _this.file.content_type.length > 0  ?",
812             "            lm.guess_language(_this.file.path, _this.file.content_type) :",
813             "            lm.get_language(lang);",
814             "     ",
815             "   ",
816             "    ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
817             "",
818             "    this.el.insert_spaces_instead_of_tabs = true;",
819             "    if (lg != null) {",
820             "\t\tprint(\"sourcelanguage  = %s\\n\", lg.name);",
821             "\t\tif (lg.name == \"Vala\") {",
822             "\t\t    this.el.insert_spaces_instead_of_tabs = false;",
823             "\t\t}",
824             "     }",
825             "    _this.dirty = false;",
826             "    this.el.grab_focus();",
827             "    _this.save_button.el.sensitive = false;",
828             "    _this.last_error_counter = -1;",
829             "}"
830            ]
831           }
832          ],
833          "xtype" : "ScrolledWindow"
834         },
835         {
836          "$ xns" : "Gtk",
837          "* pack" : "append",
838          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
839          "bool homogeneous" : false,
840          "bool vexpand" : false,
841          "int spacing" : 0,
842          "items" : [
843           {
844            "$ xns" : "Gtk",
845            "Gtk.CssProvider css" : "",
846            "bool hexpand" : true,
847            "id" : "search_entry",
848            "items" : [
849             {
850              "$ xns" : "Gtk",
851              "listeners" : {
852               "key_pressed" : [
853                "(keyval, keycode, state) => {",
854                "",
855                "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
856                "\t    GLib.debug(\"SAVE: ctrl-g  pressed\");",
857                "\t\t_this.forwardSearch(true);",
858                "\t    return true;",
859                "\t}",
860                "    ",
861                "  ",
862                " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
863                "\t\t_this.forwardSearch(true);",
864                "\t\t",
865                "\t\t",
866                "\t    return true;",
867                "",
868                "\t}    ",
869                "   // print(event.key.keyval)",
870                "   ",
871                "    return false;",
872                "}",
873                ""
874               ]
875              },
876              "xtype" : "EventControllerKey"
877             }
878            ],
879            "listeners" : {
880             "search_changed" : [
881              "( ) => {",
882              "",
883              "_this.search(_this.search_entry.el.text);",
884              "\t _this.search_results.updateResults();",
885              "",
886              "\tGLib.Timeout.add_seconds(1,() => {",
887              "\t\t _this.search_results.updateResults();",
888              "\t\t return false;",
889              "\t });",
890              "}",
891              ""
892             ]
893            },
894            "string name" : "editor-search-entry",
895            "string placeholder_text" : "Press enter to search",
896            "uint search_delay" : 3,
897            "xtype" : "SearchEntry",
898            "| void forwardSearch" : [
899             "(bool change_focus) {",
900             "",
901             "",
902             "\t_this.forwardSearch(change_focus);",
903             "",
904             "/*",
905             "",
906             "\tswitch(_this.windowstate.state) {",
907             "\t\tcase WindowState.State.CODEONLY:",
908             "\t\t//case WindowState.State.CODE:",
909             "\t\t\t// search the code being edited..",
910             "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
911             "\t\t\t ",
912             "\t\t\tbreak;",
913             "\t\tcase WindowState.State.PREVIEW:",
914             "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
915             "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
916             "\t\t\t} else { ",
917             "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
918             "\t\t\t}",
919             "\t\t",
920             "\t\t\tbreak;",
921             "\t}",
922             "\t*/",
923             "\t",
924             "}",
925             ""
926            ]
927           },
928           {
929            "$ xns" : "Gtk",
930            "id" : "search_results",
931            "int margin_end" : 4,
932            "int margin_start" : 4,
933            "string label" : "No Results",
934            "xtype" : "Label",
935            "| void updateResults" : [
936             "() {",
937             "\tthis.el.visible = true;",
938             "\t",
939             "\tvar res = _this.searchcontext.get_occurrences_count();",
940             "\tif (res < 0) {",
941             "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
942             "\t\treturn;",
943             "\t}",
944             "",
945             "\t_this.nextBtn.el.sensitive = false;",
946             "\t_this.backBtn.el.sensitive = false;\t",
947             "",
948             "\tif (res > 0) {",
949             "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
950             "\t\t_this.nextBtn.el.sensitive = true;",
951             "\t\t_this.backBtn.el.sensitive = true;",
952             "\t\treturn;",
953             "\t} ",
954             "\t_this.search_results.el.label = \"No Matches\";",
955             "\t",
956             "}"
957            ]
958           },
959           {
960            "$ xns" : "Gtk",
961            "bool always_show_image" : true,
962            "bool sensitive" : false,
963            "id" : "nextBtn",
964            "listeners" : {
965             "clicked" : [
966              "(event) => {",
967              "",
968              "\t_this.forwardSearch(true);",
969              "\t",
970              "\t ",
971              "}",
972              ""
973             ]
974            },
975            "string icon_name" : "go-down",
976            "xtype" : "Button"
977           },
978           {
979            "$ xns" : "Gtk",
980            "bool always_show_image" : true,
981            "bool sensitive" : false,
982            "id" : "backBtn",
983            "listeners" : {
984             "clicked" : [
985              "(event) => {",
986              "",
987              "\t_this.backSearch(true);",
988              "\t ",
989              "}",
990              ""
991             ]
992            },
993            "string icon_name" : "go-up",
994            "xtype" : "Button"
995           },
996           {
997            "$ xns" : "Gtk",
998            "bool always_show_arrow" : true,
999            "bool always_show_image" : true,
1000            "items" : [
1001             {
1002              "$ xns" : "Gtk",
1003              "* prop" : "popover",
1004              "id" : "search_settings",
1005              "items" : [
1006               {
1007                "$ xns" : "Gtk",
1008                "* prop" : "child",
1009                "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1010                "int spacing" : 0,
1011                "items" : [
1012                 {
1013                  "$ xns" : "Gtk",
1014                  "* init" : [
1015                   "{",
1016                   "\tthis.el.show();",
1017                   "}",
1018                   ""
1019                  ],
1020                  "id" : "case_sensitive",
1021                  "string label" : "Case Sensitive",
1022                  "xtype" : "CheckButton"
1023                 },
1024                 {
1025                  "$ xns" : "Gtk",
1026                  "* init" : [
1027                   "{",
1028                   "\tthis.el.show();",
1029                   "}",
1030                   ""
1031                  ],
1032                  "id" : "regex",
1033                  "string label" : "Regex",
1034                  "xtype" : "CheckButton"
1035                 },
1036                 {
1037                  "$ xns" : "Gtk",
1038                  "id" : "multiline",
1039                  "string label" : "Multi-line (add \\n)",
1040                  "xtype" : "CheckButton"
1041                 }
1042                ],
1043                "xtype" : "Box"
1044               }
1045              ],
1046              "xtype" : "Popover"
1047             }
1048            ],
1049            "string icon_name" : "emblem-system",
1050            "xtype" : "MenuButton"
1051           }
1052          ],
1053          "xtype" : "Box"
1054         }
1055        ],
1056        "xtype" : "Box"
1057       },
1058       {
1059        "$ xns" : "Gtk",
1060        "* prop" : "end_child",
1061        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1062        "bool hexpand" : true,
1063        "bool vexpand" : true,
1064        "int spacing" : 0,
1065        "int width_request" : 200,
1066        "items" : [
1067         {
1068          "$ xns" : "Gtk",
1069          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1070          "int spacing" : 0,
1071          "xtype" : "Box"
1072         },
1073         {
1074          "$ xns" : "Gtk",
1075          "bool hexpand" : true,
1076          "bool vexpand" : true,
1077          "bool visible" : false,
1078          "id" : "navigationwindow",
1079          "items" : [
1080           {
1081            "# int last_selected_line" : "-1",
1082            "$ Gtk.Widget? selected_row" : "null",
1083            "$ xns" : "Gtk",
1084            "* prop" : "child",
1085            "id" : "navigation",
1086            "int width_request" : 200,
1087            "items" : [
1088             {
1089              "$ xns" : "Gtk",
1090              "bool expand" : true,
1091              "items" : [
1092               {
1093                "$ xns" : "Gtk",
1094                "* prop" : "factory",
1095                "listeners" : {
1096                 "bind" : [
1097                  "(listitem) => {",
1098                  "\t ",
1099                  "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1100                  "\t",
1101                  "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1102                  "\tvar expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();",
1103                  "\t ",
1104                  "\t ",
1105                  "\tvar hbox = (Gtk.Box) expand.child;",
1106                  " ",
1107                  "\t",
1108                  "\tvar img = (Gtk.Image) hbox.get_first_child();",
1109                  "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1110                  "\t",
1111                  "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1112                  "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1113                  "\t",
1114                  "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1115                  "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1116                  "\t",
1117                  "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1118                  "\t",
1119                  "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1120                  "    ",
1121                  "    expand.set_hide_expander( sym.children.get_n_items()  < 1);",
1122                  " \texpand.set_list_row(lr);",
1123                  " \t//this.in_bind = true;",
1124                  " \t// default is to expand",
1125                  " ",
1126                  " \t//this.in_bind = false;",
1127                  " \t",
1128                  " \tsym.bind_property(\"symbol_icon\",",
1129                  "                    img, \"icon_name\",",
1130                  "                   GLib.BindingFlags.SYNC_CREATE);",
1131                  " \t",
1132                  " \thbox.css_classes = { sym.symbol_icon };",
1133                  " \t",
1134                  " \tsym.bind_property(\"name\",",
1135                  "                    lbl, \"label\",",
1136                  "                   GLib.BindingFlags.SYNC_CREATE);",
1137                  " \t// should be better?- --line no?",
1138                  " \tsym.bind_property(\"tooltip\",",
1139                  "                    lbl, \"tooltip_markup\",",
1140                  "                   GLib.BindingFlags.SYNC_CREATE);",
1141                  " \t// bind image...",
1142                  " \t",
1143                  "}",
1144                  ""
1145                 ],
1146                 "setup" : [
1147                  "(listitem) => {",
1148                  "\t",
1149                  "\tvar expand = new Gtk.TreeExpander();",
1150                  "\t ",
1151                  "\texpand.set_indent_for_depth(true);",
1152                  "\texpand.set_indent_for_icon(true);",
1153                  "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1154                  "\tvar icon = new Gtk.Image();",
1155                  "\tvar lbl = new Gtk.Label(\"\");",
1156                  "\tlbl.use_markup = true;",
1157                  "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1158                  "\t",
1159                  "\ticon.margin_end = 4;",
1160                  " \tlbl.justify = Gtk.Justification.LEFT;",
1161                  " \tlbl.xalign = 0;",
1162                  "",
1163                  "//\tlistitem.activatable = true; ??",
1164                  "\t",
1165                  "\thbox.append(icon);",
1166                  "\thbox.append(lbl);",
1167                  "\texpand.set_child(hbox);",
1168                  "\t((Gtk.ListItem)listitem).set_child(expand);",
1169                  "\t",
1170                  "}",
1171                  ""
1172                 ]
1173                },
1174                "xtype" : "SignalListItemFactory"
1175               }
1176              ],
1177              "string title" : "Code Navigation",
1178              "xtype" : "ColumnViewColumn"
1179             },
1180             {
1181              "$ xns" : "Gtk",
1182              "* prop" : "model",
1183              "id" : "navigationselmodel",
1184              "items" : [
1185               {
1186                "$ xns" : "Gtk",
1187                "* prop" : "model",
1188                "id" : "navigationsort",
1189                "items" : [
1190                 {
1191                  "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1192                   "(item) => {",
1193                   " ",
1194                   "\treturn ((Lsp.DocumentSymbol)item).children;",
1195                   "}",
1196                   ""
1197                  ],
1198                  "$ xns" : "Gtk",
1199                  "* prop" : "model",
1200                  "bool autoexpand" : true,
1201                  "bool passthrough" : false,
1202                  "items" : [
1203                   {
1204                    "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1205                    "$ xns" : "GLib",
1206                    "* prop" : "root",
1207                    "id" : "navliststore",
1208                    "xtype" : "ListStore",
1209                    "| Lsp.DocumentSymbol? symbolAtLine" : [
1210                     "(uint line, uint chr) {",
1211                     " ",
1212                     "\t",
1213                     "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1214                     "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1215                     "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1216                     "\t\t//\tel.name , (int)el.range.start.line,",
1217                     "\t\t//\t(int)el.range.end.line",
1218                     "\t\t//);",
1219                     "\t\tvar ret = el.containsLine(line,chr);",
1220                     "\t\tif (ret != null) {",
1221                     "\t\t\treturn ret;",
1222                     "\t\t}",
1223                     "\t\t",
1224                     "\t}",
1225                     "\t",
1226                     "\treturn null;",
1227                     "}"
1228                    ]
1229                   }
1230                  ],
1231                  "listeners" : {
1232                   "items_changed" : [
1233                    "(position, removed, added) => {",
1234                    "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1235                    "\t if (added < 1) { ",
1236                    "\t \treturn;",
1237                    " \t}",
1238                    "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1239                    "\tvar row = this.el.get_row(position);",
1240                    "\t",
1241                    "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1242                    "\t",
1243                    "",
1244                    "}",
1245                    ""
1246                   ]
1247                  },
1248                  "xtype" : "TreeListModel"
1249                 },
1250                 {
1251                  "$ xns" : "Gtk",
1252                  "* prop" : "sorter",
1253                  "items" : [
1254                   {
1255                    "$ xns" : "Gtk",
1256                    "* prop" : "sorter",
1257                    "items" : [
1258                     {
1259                      "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1260                      "$ xns" : "Gtk",
1261                      "* prop" : "expression",
1262                      "string property_name" : "sort_key",
1263                      "xtype" : "PropertyExpression"
1264                     }
1265                    ],
1266                    "xtype" : "StringSorter"
1267                   }
1268                  ],
1269                  "xtype" : "TreeListRowSorter"
1270                 }
1271                ],
1272                "xtype" : "SortListModel",
1273                "| Lsp.DocumentSymbol? getSymbolAt" : [
1274                 "(uint row) {",
1275                 "",
1276                 "   var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1277                 "   ",
1278                 "   var a = tr.get_item();;   ",
1279                 "   GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1280                 "  \t",
1281                 "   ",
1282                 "   return (Lsp.DocumentSymbol)tr.get_item();",
1283                 "\t ",
1284                 "}"
1285                ],
1286                "| int getRowFromSymbol" : [
1287                 "(Lsp.DocumentSymbol sym) {",
1288                 "",
1289                 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1290                 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1291                 "\t   ",
1292                 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1293                 "\t\t\treturn i;",
1294                 "\t\t}",
1295                 "\t}",
1296                 "   \treturn -1;",
1297                 "}"
1298                ],
1299                "| void collapseOnLoad" : [
1300                 "() {",
1301                 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1302                 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1303                 "\t\tvar sym =  (Lsp.DocumentSymbol)tr.get_item();",
1304                 "\t\tswitch (sym.kind) {",
1305                 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1306                 "\t \t\t\ttr.expanded = false;",
1307                 "\t \t\t\tbreak;",
1308                 "\t\t\tdefault:",
1309                 "\t\t\t\t//tr.expanded = true;",
1310                 "\t\t\t\tbreak;",
1311                 "\t\t}",
1312                 "\t}",
1313                 " ",
1314                 "\t",
1315                 "",
1316                 "",
1317                 "}"
1318                ]
1319               }
1320              ],
1321              "xtype" : "NoSelection"
1322             },
1323             {
1324              "$ xns" : "Gtk",
1325              "listeners" : {
1326               "pressed" : [
1327                "(n_press, x, y) => {",
1328                "\tstring pos;",
1329                "  \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1330                "",
1331                "    if (row == null) {",
1332                "\t    GLib.debug(\"no row selected items\");",
1333                "\t    return;",
1334                "    }",
1335                "\tGLib.debug(\"got click on %s\", row.get_type().name());    ",
1336                "    //Lsp.DocumentSymbol",
1337                "    var sym =  row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1338                "    if (sym == null) {",
1339                "    \treturn;",
1340                "\t}",
1341                "\t/*",
1342                "\t \"range\" : {",
1343                "              \"start\" : {",
1344                "                \"line\" : 1410,",
1345                "                \"character\" : 8",
1346                "              },",
1347                "              \"end\" : {",
1348                "                \"line\" : 1410,",
1349                "                \"character\" : 39",
1350                "              }",
1351                "            },",
1352                "        */",
1353                "     GLib.debug(\"goto line %d\",   (int)sym.range.start.line); ",
1354                "    _this.scroll_to_line((int)sym.range.start.line);",
1355                "    Gtk.TextIter iter;",
1356                "    _this.buffer.el.get_iter_at_line_offset(out iter, ",
1357                "    \t(int)sym.range.start.line,",
1358                "    \t(int)sym.range.start.character",
1359                "\t);",
1360                "    _this.buffer.el.place_cursor(iter);",
1361                "\t",
1362                "}"
1363               ]
1364              },
1365              "xtype" : "GestureClick"
1366             }
1367            ],
1368            "string name" : "editor-navigation",
1369            "xtype" : "ColumnView",
1370            "| Gtk.Widget? getRowWidgetAt" : [
1371             "(double x,  double  y, out string pos) {",
1372             "",
1373             "\tpos = \"\";",
1374             "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1375             "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1376             "\tif (w == null) {",
1377             "\t\treturn null;",
1378             "\t}",
1379             "\t",
1380             "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1381             "\tif (row == null) {",
1382             "\t\treturn null;",
1383             "\t}",
1384             "\t",
1385             "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1386             "\t ",
1387             " ",
1388             "\t",
1389             "\t//GLib.debug(\"row number is %d\", rn);",
1390             "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1391             "\t// above or belw",
1392             "\tGraphene.Rect  bounds;",
1393             "\trow.compute_bounds(this.el, out bounds);",
1394             "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1395             "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1396             "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1397             "\t//\t);",
1398             "\tvar ypos = y - bounds.get_y();",
1399             "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1400             "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1401             "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1402             "\tpos = \"over\";",
1403             "\t",
1404             "\tif (rpos > 80) {",
1405             "\t\tpos = \"below\";",
1406             "\t} else if (rpos < 20) {",
1407             "\t\tpos = \"above\";",
1408             "\t} ",
1409             "\treturn row;",
1410             " }"
1411            ],
1412            "| int getRowAt" : [
1413             "(double x,  double  y, out string pos) {",
1414             "",
1415             "\tpos = \"\";",
1416             "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1417             "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1418             "\tif (w == null) {",
1419             "\t\treturn -1;",
1420             "\t}",
1421             "\t",
1422             "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1423             "\tif (row == null) {",
1424             "\t\treturn -1;",
1425             "\t}",
1426             "\t",
1427             "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1428             "\t ",
1429             "\tvar rn = 0;",
1430             "\tvar cr = row;",
1431             "\t ",
1432             "\twhile (cr.get_prev_sibling() != null) {",
1433             "\t\trn++;",
1434             "\t\tcr = cr.get_prev_sibling();",
1435             "\t}",
1436             "\t",
1437             "\t//GLib.debug(\"row number is %d\", rn);",
1438             "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1439             "\t// above or belw",
1440             "\tGraphene.Rect  bounds;",
1441             "\trow.compute_bounds(this.el, out bounds);",
1442             "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1443             "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1444             "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1445             "\t//\t);",
1446             "\tvar ypos = y - bounds.get_y();",
1447             "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1448             "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1449             "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1450             "\tpos = \"over\";",
1451             "\t",
1452             "\tif (rpos > 80) {",
1453             "\t\tpos = \"below\";",
1454             "\t} else if (rpos < 20) {",
1455             "\t\tpos = \"above\";",
1456             "\t} ",
1457             "\treturn rn;",
1458             " }"
1459            ],
1460            "| void show" : [
1461             "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1462             "\t_this.navigationwindow.el.show();",
1463             "\t",
1464             "\t//_this.navliststore.el.remove_all();",
1465             "\t",
1466             "\t",
1467             "\tvar ls  = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1468             "\t",
1469             "\tforeach(var sym in syms) {",
1470             "\t\tls.append(sym);",
1471             "\t}",
1472             "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1473             "\t//_this.navliststore.el.append(sym);",
1474             "\tthis.last_selected_line = -1;",
1475             "\tGLib.Idle.add(() => {",
1476             "\t\t_this.navigationsort.collapseOnLoad();",
1477             "\t\tGtk.TextIter iter;",
1478             "\t\t_this.buffer.el.get_iter_at_offset (",
1479             "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1480             "\t\t",
1481             "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1482             "\t\t\t\titer.get_line_offset());",
1483             "\t\tthis.updateSelectedLine(",
1484             "\t\t\t\t(uint)iter.get_line(),",
1485             "\t\t\t\t(uint)iter.get_line_offset()",
1486             "\t\t);",
1487             "\t\treturn false;",
1488             "\t});",
1489             "",
1490             "}"
1491            ],
1492            "| void updateSelectedLine" : [
1493             "(uint line, uint chr) {",
1494             "\tif (line == this.last_selected_line) {",
1495             "\t\treturn;",
1496             "\t}",
1497             "\tGLib.debug(\"select line %d\", (int)line);",
1498             "\tthis.last_selected_line = (int)line;",
1499             "\t",
1500             "\t",
1501             "\tvar new_row = -1;",
1502             "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1503             "\tif (sym != null) {",
1504             "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1505             " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1506             " \t} else {",
1507             " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1508             " \t}",
1509             " \t",
1510             "\tif (this.selected_row != null) { ",
1511             "\t\tGLib.debug(\" remove selected row\");",
1512             "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1513             "\t}",
1514             "\tthis.selected_row  = null;",
1515             "\tif (new_row > -1) {",
1516             "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1517             "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1518             "\t\tif (row != null) {",
1519             "\t\t\tGLib.debug(\" Add selected row\");",
1520             " \t\t\t",
1521             "\t\t\trow.add_css_class(\"selected-row\");",
1522             "\t\t\tthis.selected_row = row;",
1523             "",
1524             "\t\t\t",
1525             "\t\t} else {",
1526             "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1527             "\t\t}",
1528             "",
1529             "\t}",
1530             "",
1531             "",
1532             "}"
1533            ]
1534           }
1535          ],
1536          "xtype" : "ScrolledWindow"
1537         }
1538        ],
1539        "xtype" : "Box"
1540       }
1541      ],
1542      "xtype" : "Paned"
1543     }
1544    ],
1545    "xtype" : "Box",
1546    "| bool saveContents" : [
1547     "  ()  {",
1548     "    ",
1549     "    ",
1550     "    if (_this.file == null) {",
1551     "        return true;",
1552     "    }",
1553     "    ",
1554     "     ",
1555     "     ",
1556     "     var str = _this.buffer.toString();",
1557     "     ",
1558     "     _this.buffer.checkSyntax();",
1559     "     ",
1560     "     ",
1561     "     ",
1562     "     // LeftPanel.model.changed(  str , false);",
1563     "     _this.dirty = false;",
1564     "     _this.save_button.el.sensitive = false;",
1565     "     ",
1566     "    // find the text for the node..",
1567     "    if (_this.file.xtype != \"PlainFile\") {",
1568     "       // in theory these properties have to exist!?!",
1569     "    \tthis.prop.val = str;",
1570     "        //this.window.windowstate.left_props.reload();",
1571     "    } else {",
1572     "        _this.file.setSource(  str );",
1573     "     }",
1574     "    ",
1575     "    // call the signal..",
1576     "    this.save();",
1577     "    ",
1578     "    return true;",
1579     "",
1580     "} "
1581    ],
1582    "| int search" : [
1583     "(string in_txt) {",
1584     "",
1585     "\tvar s = new GtkSource.SearchSettings();",
1586     "\ts.case_sensitive = _this.case_sensitive.el.active;",
1587     "\ts.regex_enabled = _this.regex.el.active;\t",
1588     "\ts.wrap_around = false;",
1589     "\t",
1590     "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1591     "\tthis.searchcontext.set_highlight(true);",
1592     "\tvar txt = in_txt;",
1593     "\t",
1594     "\tif (_this.multiline.el.active) {",
1595     "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1596     "\t}",
1597     "\t",
1598     "\ts.set_search_text(txt);",
1599     "\tGtk.TextIter beg, st,en;",
1600     "\t ",
1601     "\tthis.buffer.el.get_start_iter(out beg);",
1602     "\tbool has_wrapped_around;",
1603     "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1604     "\tthis.last_search_end = 0;",
1605     "\t",
1606     "\treturn this.searchcontext.get_occurrences_count();",
1607     "",
1608     " ",
1609     "   ",
1610     "",
1611     "}",
1612     ""
1613    ],
1614    "| string tempFileContents" : [
1615     "() {",
1616     "   ",
1617     "   ",
1618     "   if (_this.file == null) {",
1619     "       return \"\";",
1620     "   }",
1621     "\tvar str= this.buffer.toString();",
1622     "\tif (_this.file.xtype == \"PlainFile\") {",
1623     "    ",
1624     "     \treturn str;",
1625     "    ",
1626     "    }",
1627     "  ",
1628     "      ",
1629     "     ",
1630     "    GLib.debug(\"calling validate\");    ",
1631     "    // clear the buttons.",
1632     " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1633     "\t\treturn this.file.toSource(); ;",
1634     "\t}",
1635     "\t",
1636     "\tvar oldcode  = _this.prop.val;",
1637     "\t_this.prop.val = str;",
1638     "    var ret = _this.file.toSource();",
1639     "    _this.prop.val = oldcode;",
1640     "    return ret;",
1641     "    ",
1642     "}"
1643    ],
1644    "| void backSearch" : [
1645     "(bool change_focus) {",
1646     "",
1647     "\tif (this.searchcontext == null) {",
1648     "\t\treturn;",
1649     "\t}",
1650     "\t",
1651     "\tGtk.TextIter beg, st,en;",
1652     "\tbool has_wrapped_around;",
1653     "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1654     "\t",
1655     "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1656     "\t\tthis.last_search_end = 0;",
1657     "\t} else {",
1658     "\t\tthis.last_search_end = en.get_offset();",
1659     "\t\tif (change_focus) {",
1660     "\t\t\tthis.view.el.grab_focus();",
1661     "\t\t}",
1662     "\t\tthis.buffer.el.place_cursor(st);",
1663     "\t\tthis.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);",
1664     "\t}",
1665     "",
1666     "}",
1667     ""
1668    ],
1669    "| void forwardSearch" : [
1670     "(bool change_focus) {",
1671     "",
1672     "\tif (this.searchcontext == null) {",
1673     "\t\treturn;",
1674     "\t} ",
1675     "",
1676     "\tGtk.TextIter beg, st,en;",
1677     "\t bool has_wrapped_around;",
1678     "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1679     "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1680     "\t",
1681     "\t\tthis.last_search_end = 0; // not sure if this should happen",
1682     "\t} else {",
1683     "\t\tif (has_wrapped_around) {",
1684     "\t\t\treturn;",
1685     "\t\t}",
1686     "\t",
1687     "\t\tthis.last_search_end = en.get_offset();",
1688     "\t\tif (change_focus) {",
1689     "\t\t\tthis.view.el.grab_focus();",
1690     "\t\t}",
1691     "\t\tthis.buffer.el.place_cursor(st);",
1692     "\t\tthis.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);",
1693     "\t}",
1694     " ",
1695     "}",
1696     ""
1697    ],
1698    "| void reset" : [
1699     "() {",
1700     "\t this.file = null;    ",
1701     "     ",
1702     "    this.node = null;",
1703     "    this.prop = null;",
1704     "\tthis.searchcontext = null;",
1705     "  ",
1706     "}",
1707     ""
1708    ],
1709    "| void scroll_to_line" : [
1710     "(int line) {",
1711     "",
1712     "\tGLib.Timeout.add(500, () => {",
1713     "   ",
1714     "\t\tvar buf = this.view.el.get_buffer();",
1715     "",
1716     "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1717     "",
1718     "",
1719     "\t\tGtk.TextIter iter;   ",
1720     "\t\tsbuf.get_iter_at_line(out iter,  line);",
1721     "\t\tthis.view.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);",
1722     "\t\treturn false;",
1723     "\t});   ",
1724     "}",
1725     ""
1726    ],
1727    "| void show" : [
1728     "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1729     "{",
1730     "    this.reset();",
1731     "    if (this.file != null) {",
1732     "    \tthis.file.navigation_tree_updated.disconnect(",
1733     "    \t\t_this.navigation.show",
1734     "    \t);",
1735     "    }",
1736     "    this.file = file;    ",
1737     "    this.file.navigation_tree_updated.connect(",
1738     "\t\t_this.navigation.show",
1739     "\t);",
1740     "    if (file.xtype != \"PlainFile\") {",
1741     "    \tthis.prop = prop;",
1742     "        this.node = node;",
1743     "",
1744     "        // find the text for the node..",
1745     "        this.view.load( prop.val );",
1746     "        this.updateErrorMarks();",
1747     "        ",
1748     "        ",
1749     "        ",
1750     "        this.close_btn.el.show();       ",
1751     "    ",
1752     "    } else {",
1753     "        this.view.load(        file.toSource() );",
1754     "        this.updateErrorMarks();",
1755     "        this.close_btn.el.hide();",
1756     "        var ls = file.getLanguageServer();",
1757     "        ls.queueDocumentSymbols(file);",
1758     "        ////ls.documentSymbols.begin(file, (a,o) => {",
1759     "        //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1760     "       //});",
1761     "        //documentSymbols",
1762     "        ",
1763     "    }",
1764     " ",
1765     "}"
1766    ],
1767    "| void updateErrorMarks" : [
1768     "() {",
1769     "\t",
1770     " ",
1771     "",
1772     "\tvar buf = _this.buffer.el;",
1773     "\tGtk.TextIter start;",
1774     "\tGtk.TextIter end;     ",
1775     "\tbuf.get_bounds (out start, out end);",
1776     "",
1777     "\t",
1778     "",
1779     " ",
1780     "\t//GLib.debug(\"highlight errors\");\t\t ",
1781     "",
1782     "\t // we should highlight other types of errors..",
1783     "",
1784     "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1785     "\t\t&&",
1786     "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1787     "\t\t) {",
1788     "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1789     "\t\t",
1790     "\t\treturn;",
1791     "\t} ",
1792     "",
1793     "\t ",
1794     "\tif (_this.file == null) {",
1795     "\t\tGLib.debug(\"file is null?\");",
1796     "\t\treturn;",
1797     "",
1798     "\t}",
1799     "\tvar ar = this.file.getErrors();",
1800     "\tif (ar.size < 1) {",
1801     "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1802     "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1803     "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1804     "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1805     "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1806     "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1807     "\t\tthis.last_error_counter = file.error_counter ;",
1808     "\t\t//GLib.debug(\"highlight %s :  %s has no errors\", this.file.relpath, category);",
1809     "\t\treturn;",
1810     "\t}",
1811     "\t",
1812     "",
1813     " // basicaly check if there is no change, then we do not do any update..",
1814     " // we can do this by just using an error counter?",
1815     " // if that's changed then we will do an update, otherwise dont bother.",
1816     "\t  ",
1817     "\t",
1818     "\tvar offset = 0;",
1819     "\tvar hoffset = 0;",
1820     "",
1821     "\tvar tlines = buf.get_line_count () +1;",
1822     "\t",
1823     "\tif (_this.prop != null) {",
1824     "\t\t// this still seems flaky...",
1825     "",
1826     "\t\ttlines = _this.prop.end_line;",
1827     "\t\toffset = _this.prop.start_line;",
1828     "\t\thoffset = _this.node.node_pad.length + 2; //shift it left  by 2 ? ..",
1829     "\t\t",
1830     "\t\t ",
1831     "\t} else {",
1832     "\t\t// no update...",
1833     "\t\tif (this.last_error_counter == file.error_counter) {",
1834     "\t\t",
1835     "\t\t\treturn;",
1836     "\t\t}",
1837     "\t",
1838     "\t}",
1839     "\tbuf.remove_source_marks (start, end, \"ERR\");",
1840     "\tbuf.remove_source_marks (start, end, \"WARN\");",
1841     "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1842     "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1843     "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1844     "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1845     "\t",
1846     "\tforeach(var diag in ar) { ",
1847     "\t     Gtk.TextIter iter;",
1848     "//        print(\"get inter\\n\");",
1849     "\t    var eline = (int)diag.range.start.line - offset;",
1850     "\t    var eline_to = (int)diag.range.end.line - offset;",
1851     "\t    //var eline =  diag.range.end_line - offset;",
1852     "\t    //GLib.debug(\"GOT ERROR on line %d -- converted to %d  (offset = %d)\",",
1853     "\t    //\terr.line ,eline, offset);",
1854     "\t    ",
1855     "\t    ",
1856     "\t    if (eline > tlines || eline < 0) {",
1857     "\t        continue;",
1858     "\t    }",
1859     "\t    ",
1860     "\t    buf.get_iter_at_line( out iter, eline);",
1861     "\t   \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1862     "\t    buf.create_source_mark( msg, diag.category, iter);",
1863     "\t    ",
1864     " \t    var spos = (int)diag.range.start.character - hoffset;",
1865     " \t    if (spos < 0) { spos =0 ; }",
1866     " \t    if (spos > iter.get_chars_in_line()) {",
1867     " \t    \tspos = iter.get_chars_in_line();",
1868     "    \t}",
1869     "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1870     "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1871     " \t    if (epos < 0) { epos =0 ; }",
1872     " \t    if (epos > iter.get_chars_in_line()) {",
1873     " \t    \tepos = iter.get_chars_in_line();",
1874     "    \t}",
1875     " \t     ",
1876     " \t    ",
1877     " \t    buf.get_iter_at_line_offset( out start, eline, spos); ",
1878     " \t   ",
1879     " \t    buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1880     " \t    \t",
1881     "\t    buf.apply_tag_by_name(diag.category, start, end);",
1882     "\t    ",
1883     "\t   // GLib.debug(\"set line %d to %s\", eline, msg);",
1884     "\t    //this.marks.set(eline, msg);",
1885     "\t}",
1886     "\tthis.last_error_counter = file.error_counter ;",
1887     "",
1888     "",
1889     "",
1890     " ",
1891     "",
1892     "}"
1893    ]
1894   }
1895  ],
1896  "name" : "Editor"
1897 }