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