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