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