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