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