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