2 "build_module" : "builder",
3 "gen_extended" : false,
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,
13 "# int last_error_counter" : 0,
14 "# int pos_root_x" : "",
15 "# int pos_root_y" : "",
16 "# string activeEditor" : "\"\"",
17 "$ homogeneous" : false,
20 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21 "bool hexpand" : true,
22 "bool vexpand" : true,
23 "int last_search_end" : 0,
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,
36 "* prop" : "start_child",
37 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
38 "bool hexpand" : true,
42 "$ homogeneous" : false,
44 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
45 "bool hexpand" : false,
46 "bool vexpand" : false,
50 "bool vexpand" : true,
56 " _this.saveContents();",
65 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
66 "bool hexpand" : true,
70 "int margin_start" : 4,
73 "(x, y, keyboard_tooltip, tooltip) => {",
74 "\tGLib.debug(\"using quiery tooltip?\");",
75 "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);",
76 "\tlbl.width_request = 500;",
77 "\ttooltip.set_custom(lbl);",
86 "(Lsp.Hover? help) {",
87 "\tif (help == null || help.contents == null",
88 "\t\t|| help.contents.size < 1) {",
89 "\t\tthis.el.set_text(\"\");",
92 "\tvar sig = help.contents.get(0).value.split(\" \");",
93 "\tstring[] str = {};",
94 "\tfor(var i =0; i < sig.length; i++) {",
96 "\t\tswitch(sig[i]) {",
97 "\t\t\tcase \"public\":",
98 "\t\t\tcase \"private\":",
99 "\t\t\tcase \"protected\":",
100 "\t\t\tcase \"async\":",
101 "\t\t\tcase \"class\":",
107 "\t\t\t\tstr += sig[i];",
113 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
114 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
115 "\t\t\t\t\t+\"</span>\");",
119 "\tif (help.contents.size > 1) {",
120 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
122 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text((help.contents.get(0).value)",
124 "\tthis.el.set_markup(string.joinv(\" \",str));",
131 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
134 "\t//this.el.set_range(6,30);",
135 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
136 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
138 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
139 " \t\t//\tGLib.debug(\"update range\");",
140 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
141 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
149 "Gtk.Align halign" : "Gtk.Align.END",
150 "bool draw_value" : false,
151 "bool has_origin" : true,
152 "bool sensitive" : true,
154 "int width_request" : 150,
158 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
161 " \tBuilderApplication.settings.editor_font_size = val;",
170 "Gtk.Align halign" : "Gtk.Align.END",
176 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
177 "string icon_name" : "window-close",
184 " _this.saveContents();",
185 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
190 "string icon_name" : "window-close",
198 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
199 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
200 "bool overlay_scrolling" : false,
201 "bool vexpand" : true,
202 "id" : "RightEditor",
205 "# Gtk.CssProvider css" : "null",
206 "$ gboolean auto_indent" : true,
207 "$ xns" : "GtkSource",
214 "this.el.completion.add_provider(",
215 "\tnew Palete.CompletionProvider(_this)",
218 "// hover seems pretty useless.. - ??",
219 "//var hover = this.el.get_hover();",
220 "//hover.add_provider(new Palete.HoverProvider(_this));",
222 "//this.el.completion.unblock_interactive();",
223 "this.el.completion.select_on_show = true; // select",
224 "//this.el.completion.remember_info_visibility\t = true;",
227 "var attrs = new GtkSource.MarkAttributes();",
229 "attrs.set_icon_name ( \"process-stop\"); ",
230 "attrs.query_tooltip_text.connect(( mark) => {",
231 " GLib.debug(\"tooltip query? %s\", mark.name);",
232 " return strdup( mark.name);",
234 " attrs.query_tooltip_markup.connect(( mark) => {",
235 " GLib.debug(\"tooltip query? %s\", mark.name);",
236 " return strdup( mark.name);",
238 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
242 "var wattrs = new GtkSource.MarkAttributes();",
243 "wattrs.set_icon_name ( \"process-stop\"); ",
244 "wattrs.query_tooltip_text.connect(( mark) => {",
245 " GLib.debug(\"tooltip query? %s\", mark.name);",
246 " return strdup(mark.name);",
248 "wattrs.query_tooltip_markup.connect(( mark) => {",
249 " GLib.debug(\"tooltip query? %s\", mark.name);",
250 " return strdup(mark.name);",
252 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
256 "var dattrs = new GtkSource.MarkAttributes();",
258 "dattrs.set_icon_name ( \"process-stop\"); ",
260 "dattrs.query_tooltip_text.connect(( mark) => {",
261 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
262 " return strdup(mark.name);",
264 "//dattrs.query_tooltip_markup.connect(( mark) => {",
265 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
266 " // return strdup(mark.name);",
268 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
271 " this.el.get_space_drawer().set_matrix(null);",
272 " this.el.get_space_drawer().set_types_for_locations( ",
273 "\tGtkSource.SpaceLocationFlags.ALL,",
274 "\tGtkSource.SpaceTypeFlags.ALL",
276 "this.el.get_space_drawer().set_enable_matrix(true);",
280 "bool has_tooltip" : true,
281 "bool hexpand" : true,
282 "bool insert_spaces_instead_of_tabs" : true,
283 "bool vexpand" : true,
284 "boolean show_line_marks" : true,
285 "boolean show_line_numbers" : true,
286 "css_classes" : "{ \"code-editor\" }",
287 "gboolean highlight_current_line" : true,
292 "$ Gee.HashMap<int,string>? xmarks" : "null",
293 "$ xns" : "GtkSource",
294 "$ xtype" : "Buffer",
297 "var buf = this.el;",
298 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
299 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
300 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
301 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
302 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
303 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
304 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
305 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
308 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
309 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
310 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
316 "bool check_queued" : false,
317 "bool enable_undo" : true,
318 "bool highlight_matching_brackets" : true,
319 "bool highlight_syntax" : true,
321 "int error_line" : "-1",
325 " // check syntax??",
327 " _this.save_button.el.sensitive = true;",
328 " print(\"EDITOR CHANGED\");",
329 " this.checkSyntax();",
331 " _this.dirty = true;",
333 " // this.get('/LeftPanel.model').changed( str , false);",
341 "\tGtk.TextIter iter;",
342 "\tthis.el.get_iter_at_offset (",
343 "\t\t\tout iter, this.el.cursor_position);",
345 "\t_this.navigation.updateSelectedLine(",
346 "\t\t\t(uint)iter.get_line(),",
347 "\t\t\t(uint)iter.get_line_offset()",
349 "\tthis.showHelp(iter);",
355 "| bool OLDhighlightErrorsJson" : [
356 "(string type, Json.Object obj) {",
357 "\tGtk.TextIter start;",
358 "\tGtk.TextIter end; ",
359 "\tthis.el.get_bounds (out start, out end);",
361 "\tthis.el.remove_source_marks (start, end, type);",
362 "\tGLib.debug(\"highlight errors\");\t\t ",
364 "\t // we should highlight other types of errors..",
366 "\tif (!obj.has_member(type)) {",
367 "\t\tGLib.debug(\"Return has no errors\\n\");",
371 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
373 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
375 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
380 "\t//this.marks = new Gee.HashMap<int,string>();",
381 "\tvar err = obj.get_object_member(type);",
383 "\tif (_this.file == null) {",
384 "\t\tGLib.debug(\"file is null?\");",
388 "\tvar valafn = _this.file.path;",
390 "\tif (_this.file.xtype != \"PlainFile\") {",
392 "\t\tvalafn = \"\";",
394 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
395 "\t\t\t// should not happen",
396 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
397 "\t\t} catch (GLib.RegexError e) {",
398 "\t\t\treturn true;",
404 "\tif (!err.has_member(valafn)) {",
405 "\t\tGLib.debug(\"File path has no errors\");",
409 "\tvar lines = err.get_object_member(valafn);",
412 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
413 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
417 "\tvar tlines = this.el.get_line_count () +1;",
419 "\tif (_this.prop != null) {",
421 "\t\ttlines = _this.prop.end_line + 1;",
422 "\t\toffset = _this.prop.start_line + 1;",
428 "\tlines.foreach_member((obj, line, node) => {",
430 "\t Gtk.TextIter iter;",
431 "// print(\"get inter\\n\");",
432 "\t var eline = int.parse(line) - offset;",
433 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
436 "\t if (eline > tlines || eline < 0) {",
441 "\t this.el.get_iter_at_line( out iter, eline);",
442 "\t //print(\"mark line\\n\");",
443 "\t var msg = \"\";",
444 "\t var ar = lines.get_array_member(line);",
445 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
446 "\t \tif (ar.get_string_element(i) == \"Success\") {",
449 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
450 "\t\t\tmsg += ar.get_string_element(i);",
452 "\t\tif (msg == \"\") {",
455 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
456 "\t this.el.create_source_mark(msg, type, iter);",
457 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
458 "\t // this.marks.set(eline, msg);",
469 "| bool checkSyntax" : [
473 " var str = this.toString();",
476 " if (this.error_line > 0) {",
477 " Gtk.TextIter start;",
478 " Gtk.TextIter end; ",
479 " this.el.get_bounds (out start, out end);",
481 " this.el.remove_source_marks (start, end, null);",
483 " if (str.length < 1) {",
484 " print(\"checkSyntax - empty string?\\n\");",
488 " // bit presumptiona",
489 " if (_this.file.xtype == \"PlainFile\") {",
491 " // assume it's gtk...",
492 " var oldcode =_this.file.toSource();",
493 " _this.file.setSource(str);",
494 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
495 " \t_this.file.getLanguageServer().document_change(_this.file);",
496 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
497 " _this.file.setSource(oldcode);",
503 " if (_this.file == null) {",
511 " GLib.debug(\"calling validate\"); ",
512 " // clear the buttons.",
513 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
516 "\tvar oldcode = _this.prop.val;",
518 "\t_this.prop.val = str;",
519 "\t_this.node.updated_count++;",
520 " _this.file.getLanguageServer().document_change(_this.file);",
521 " _this.node.updated_count++;",
522 " _this.prop.val = oldcode;",
525 " //print(\"done mark line\\n\");",
527 " return true; // at present allow saving - even if it's invalid..",
531 "| bool highlightErrors" : [
532 "( Gee.HashMap<int,string> validate_res) {",
534 "\tthis.error_line = validate_res.size;",
536 "\tif (this.error_line < 1) {",
539 "\tvar tlines = this.el.get_line_count ();",
540 "\tGtk.TextIter iter;",
541 "\tvar valiter = validate_res.map_iterator();",
542 "\twhile (valiter.next()) {",
544 "\t// print(\"get inter\\n\");",
545 "\t\tvar eline = valiter.get_key();",
546 "\t\tif (eline > tlines) {",
549 "\t\tthis.el.get_iter_at_line( out iter, eline);",
550 "\t\t//print(\"mark line\\n\");",
551 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
556 "| string toString" : [
561 " this.el.get_start_iter(out s);",
562 " this.el.get_end_iter(out e);",
563 " var ret = this.el.get_text(s,e,true);",
564 " //print(\"TO STRING? \" + ret);",
569 "| void showHelp" : [
570 "(Gtk.TextIter iter) {",
571 "\tvar back = iter.copy();",
572 "\tback.backward_char();",
574 "\tvar forward = iter.copy();",
575 "\tforward.forward_char();",
577 "\t// what's the character at the iter?",
578 "\tvar str = back.get_text(iter);",
579 "\tstr += iter.get_text(forward);",
580 "\tif (str.strip().length < 1) {",
583 "\tvar offset = iter.get_line_offset();",
584 "\tvar line = iter.get_line();",
585 "\tif (_this.prop != null) {",
587 "\t\tline += _this.prop.start_line ; ",
588 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
589 "\t\toffset += _this.node.node_pad.length;",
590 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
591 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
592 "\t\t\toffset += 2;",
596 "\tvar ls = _this.file.getLanguageServer();",
598 "\t\t_this.file, line, offset,",
601 "\t\t\t\tvar res = ls.hover.end(o );",
603 "\t\t\t\t_this.helper.setHelp(res);",
604 "\t\t\t} catch (GLib.Error e) {",
614 "# bool is_control" : false,
619 "(keyval, keycode, state) => {",
621 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
622 " \t\tthis.is_control = true;",
629 "(keyval, keycode, state) => {",
631 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
632 " \t\tthis.is_control = false;",
634 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
635 " GLib.debug(\"SAVE: ctrl-S pressed\");",
636 " _this.saveContents();",
640 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
641 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
642 "\t\t_this.forwardSearch(true);",
645 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
646 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
647 "\t\t_this.search_entry.el.grab_focus();",
648 "\t\t_this.search_entry.el.select_region(0,-1);",
651 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
652 "\t\t_this.view.el.show_completion();",
655 "\tGtk.TextIter iter;",
656 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
657 "\tvar line = iter.get_line();",
658 "\tvar offset = iter.get_line_offset();",
659 "\tGLib.debug(\"line %d off %d\", line ,offset);",
660 "\tif (_this.prop != null) {",
661 "\t\tline += _this.prop.start_line + 1; // i think..",
662 "\t\toffset += 12; // should probably be 8 without namespaced ",
663 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
665 " //_this.view.el.show_completion();",
666 " // print(event.key.keyval)",
676 "xtype" : "EventControllerKey"
679 "# double distance" : "0.0f",
681 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
685 "\tif (!_this.keystate.is_control) {",
688 "\t //GLib.debug(\"scroll %f\", dy);",
690 "\tthis.distance += dy;",
692 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
694 "\t if (this.distance < -1) {",
696 "\t\tBuilderApplication.settings.editor_font_size ++;",
697 "\t\tthis.distance = 0;",
699 "\tif (this.distance > 1) {",
700 "\t\tBuilderApplication.settings.editor_font_size --;",
701 "\t\tthis.distance = 0;",
709 "xtype" : "EventControllerScroll"
715 "(n_press, x, y) => {",
716 "\tGtk.TextIter iter;",
717 "\tint buffer_x, buffer_y;",
718 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
720 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
721 "\t\t(int)x - gut.get_width(), (int)y,",
722 " \t\tout buffer_x, out buffer_y);",
723 "\t_this.view.el.get_iter_at_location (out iter, ",
724 "\t\t\tbuffer_x, buffer_y);;",
727 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
728 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
732 "\t_this.buffer.showHelp(iter);",
740 "xtype" : "GestureClick"
745 "(x, y, keyboard_tooltip, tooltip) => {",
747 "\t//GLib.debug(\"query tooltip\");",
748 "\tGtk.TextIter iter;",
751 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
753 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
755 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
756 "\t//\treturn false;",
759 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
761 "\tvar l = iter.get_line();",
765 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
771 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
772 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
773 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
781 "\t// this crashes?? - not sure why.",
782 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
783 "\tif (marks.is_empty()) {",
784 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
786 "\tif (marks.is_empty()) {",
787 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
790 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
792 "\tmarks.@foreach((m) => { ",
793 "\t\t//GLib.debug(\"got mark %s\", m.name);",
794 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
796 "\t// true if there is a mark..",
797 "\tif (str.length > 0 ) {",
798 "\t\ttooltip.set_text( str );",
800 "\treturn str.length > 0 ? true : false;",
806 "string name" : "editor-view",
807 "uint tab_width" : 4,
812 "// show the help page for the active node..",
813 " //this.get('/Help').show();",
815 " // this.get('/BottomPane').el.set_current_page(0);",
816 " \tGLib.debug(\"load called - Reset undo buffer\");",
818 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
819 " buf.begin_irreversible_action();",
820 " buf.set_text(str, str.length);",
821 " buf.end_irreversible_action();",
823 " var lm = GtkSource.LanguageManager.get_default();",
824 " var lang = \"vala\";",
825 " if (_this.file != null) {",
826 " lang = _this.file.language;",
828 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
829 " var lg = _this.file.content_type.length > 0 ?",
830 " lm.guess_language(_this.file.path, _this.file.content_type) :",
831 " lm.get_language(lang);",
834 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
836 " this.el.insert_spaces_instead_of_tabs = true;",
837 " if (lg != null) {",
838 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
839 "\t\tif (lg.name == \"Vala\") {",
840 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
843 " _this.dirty = false;",
844 " this.el.grab_focus();",
845 " _this.save_button.el.sensitive = false;",
846 " _this.last_error_counter = -1;",
851 "xtype" : "ScrolledWindow"
856 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
857 "bool homogeneous" : false,
858 "bool vexpand" : false,
863 "Gtk.CssProvider css" : "",
864 "bool hexpand" : true,
865 "id" : "search_entry",
871 "(keyval, keycode, state) => {",
873 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
874 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
875 "\t\t_this.forwardSearch(true);",
880 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
881 "\t\t_this.forwardSearch(true);",
887 " // print(event.key.keyval)",
894 "xtype" : "EventControllerKey"
901 "_this.search(_this.search_entry.el.text);",
902 "\t _this.search_results.updateResults();",
904 "\tGLib.Timeout.add_seconds(1,() => {",
905 "\t\t _this.search_results.updateResults();",
906 "\t\t return false;",
912 "string name" : "editor-search-entry",
913 "string placeholder_text" : "Press enter to search",
914 "uint search_delay" : 3,
915 "xtype" : "SearchEntry",
916 "| void forwardSearch" : [
917 "(bool change_focus) {",
920 "\t_this.forwardSearch(change_focus);",
924 "\tswitch(_this.windowstate.state) {",
925 "\t\tcase WindowState.State.CODEONLY:",
926 "\t\t//case WindowState.State.CODE:",
927 "\t\t\t// search the code being edited..",
928 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
931 "\t\tcase WindowState.State.PREVIEW:",
932 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
933 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
935 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
948 "id" : "search_results",
949 "int margin_end" : 4,
950 "int margin_start" : 4,
951 "string label" : "No Results",
953 "| void updateResults" : [
955 "\tthis.el.visible = true;",
957 "\tvar res = _this.searchcontext.get_occurrences_count();",
959 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
963 "\t_this.nextBtn.el.sensitive = false;",
964 "\t_this.backBtn.el.sensitive = false;\t",
967 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
968 "\t\t_this.nextBtn.el.sensitive = true;",
969 "\t\t_this.backBtn.el.sensitive = true;",
972 "\t_this.search_results.el.label = \"No Matches\";",
979 "bool always_show_image" : true,
980 "bool sensitive" : false,
986 "\t_this.forwardSearch(true);",
993 "string icon_name" : "go-down",
998 "bool always_show_image" : true,
999 "bool sensitive" : false,
1005 "\t_this.backSearch(true);",
1011 "string icon_name" : "go-up",
1016 "bool always_show_arrow" : true,
1017 "bool always_show_image" : true,
1021 "* prop" : "popover",
1022 "id" : "search_settings",
1027 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1034 "\tthis.el.show();",
1038 "id" : "case_sensitive",
1039 "string label" : "Case Sensitive",
1040 "xtype" : "CheckButton"
1046 "\tthis.el.show();",
1051 "string label" : "Regex",
1052 "xtype" : "CheckButton"
1057 "string label" : "Multi-line (add \\n)",
1058 "xtype" : "CheckButton"
1067 "string icon_name" : "emblem-system",
1068 "xtype" : "MenuButton"
1078 "* prop" : "end_child",
1079 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1080 "bool hexpand" : true,
1081 "bool vexpand" : true,
1082 "bool visible" : false,
1083 "id" : "navigation_holder",
1085 "int width_request" : 120,
1089 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1095 "bool hexpand" : true,
1096 "bool vexpand" : true,
1097 "bool visible" : true,
1098 "id" : "navigationwindow",
1101 "# int last_selected_line" : "-1",
1102 "$ Gtk.Widget? selected_row" : "null",
1105 "id" : "navigation",
1109 "bool expand" : true,
1113 "* prop" : "factory",
1118 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1120 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1121 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1124 "\tvar hbox = (Gtk.Box) expand.child;",
1127 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1128 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1130 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1131 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1133 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1134 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1136 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1138 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1140 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1141 " \texpand.set_list_row(lr);",
1142 " \t//this.in_bind = true;",
1143 " \t// default is to expand",
1145 " \t//this.in_bind = false;",
1147 " \tsym.bind_property(\"symbol_icon\",",
1148 " img, \"icon_name\",",
1149 " GLib.BindingFlags.SYNC_CREATE);",
1151 " \thbox.css_classes = { sym.symbol_icon };",
1153 " \tsym.bind_property(\"name\",",
1155 " GLib.BindingFlags.SYNC_CREATE);",
1156 " \t// should be better?- --line no?",
1157 " \tsym.bind_property(\"tooltip\",",
1158 " lbl, \"tooltip_markup\",",
1159 " GLib.BindingFlags.SYNC_CREATE);",
1160 " \t// bind image...",
1168 "\tvar expand = new Gtk.TreeExpander();",
1170 "\texpand.set_indent_for_depth(true);",
1171 "\texpand.set_indent_for_icon(true);",
1172 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1173 "\tvar icon = new Gtk.Image();",
1174 "\tvar lbl = new Gtk.Label(\"\");",
1175 "\tlbl.use_markup = true;",
1176 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1178 "\ticon.margin_end = 4;",
1179 " \tlbl.justify = Gtk.Justification.LEFT;",
1180 " \tlbl.xalign = 0;",
1182 "//\tlistitem.activatable = true; ??",
1184 "\thbox.append(icon);",
1185 "\thbox.append(lbl);",
1186 "\texpand.set_child(hbox);",
1187 "\t((Gtk.ListItem)listitem).set_child(expand);",
1193 "xtype" : "SignalListItemFactory"
1196 "string title" : "Code Navigation",
1197 "xtype" : "ColumnViewColumn"
1202 "id" : "navigationselmodel",
1207 "id" : "navigationsort",
1210 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1213 "\treturn ((Lsp.DocumentSymbol)item).children;",
1219 "bool autoexpand" : true,
1220 "bool passthrough" : false,
1223 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1226 "id" : "navliststore",
1227 "xtype" : "ListStore",
1228 "| Lsp.DocumentSymbol? symbolAtLine" : [
1229 "(uint line, uint chr) {",
1232 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1233 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1234 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1235 "\t\t//\tel.name , (int)el.range.start.line,",
1236 "\t\t//\t(int)el.range.end.line",
1238 "\t\tvar ret = el.containsLine(line,chr);",
1239 "\t\tif (ret != null) {",
1240 "\t\t\treturn ret;",
1252 "(position, removed, added) => {",
1253 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1254 "\t if (added < 1) { ",
1257 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1258 "\tvar row = this.el.get_row(position);",
1260 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1267 "xtype" : "TreeListModel"
1271 "* prop" : "sorter",
1275 "* prop" : "sorter",
1278 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1280 "* prop" : "expression",
1281 "string property_name" : "sort_key",
1282 "xtype" : "PropertyExpression"
1285 "xtype" : "StringSorter"
1288 "xtype" : "TreeListRowSorter"
1291 "xtype" : "SortListModel",
1292 "| Lsp.DocumentSymbol? getSymbolAt" : [
1295 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1297 " var a = tr.get_item();; ",
1298 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1301 " return (Lsp.DocumentSymbol)tr.get_item();",
1305 "| int getRowFromSymbol" : [
1306 "(Lsp.DocumentSymbol sym) {",
1308 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1309 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1311 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1318 "| void collapseOnLoad" : [
1320 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1321 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1322 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1323 "\t\tswitch (sym.kind) {",
1324 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1325 "\t \t\t\ttr.expanded = false;",
1328 "\t\t\t\t//tr.expanded = true;",
1340 "xtype" : "NoSelection"
1346 "(n_press, x, y) => {",
1348 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1350 " if (row == null) {",
1351 "\t GLib.debug(\"no row selected items\");",
1354 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1355 " //Lsp.DocumentSymbol",
1356 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1357 " if (sym == null) {",
1363 " \"line\" : 1410,",
1364 " \"character\" : 8",
1367 " \"line\" : 1410,",
1368 " \"character\" : 39",
1372 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1373 " _this.scroll_to_line((int)sym.range.start.line);",
1374 " Gtk.TextIter iter;",
1375 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1376 " \t(int)sym.range.start.line,",
1377 " \t(int)sym.range.start.character",
1379 " _this.buffer.el.place_cursor(iter);",
1384 "xtype" : "GestureClick"
1387 "string name" : "editor-navigation",
1388 "xtype" : "ColumnView",
1389 "| Gtk.Widget? getRowWidgetAt" : [
1390 "(double x, double y, out string pos) {",
1393 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1394 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1395 "\tif (w == null) {",
1399 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1400 "\tif (row == null) {",
1404 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1408 "\t//GLib.debug(\"row number is %d\", rn);",
1409 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1410 "\t// above or belw",
1411 "\tGraphene.Rect bounds;",
1412 "\trow.compute_bounds(this.el, out bounds);",
1413 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1414 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1415 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1417 "\tvar ypos = y - bounds.get_y();",
1418 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1419 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1420 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1421 "\tpos = \"over\";",
1423 "\tif (rpos > 80) {",
1424 "\t\tpos = \"below\";",
1425 "\t} else if (rpos < 20) {",
1426 "\t\tpos = \"above\";",
1431 "| int getRowAt" : [
1432 "(double x, double y, out string pos) {",
1435 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1436 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1437 "\tif (w == null) {",
1441 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1442 "\tif (row == null) {",
1446 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1451 "\twhile (cr.get_prev_sibling() != null) {",
1453 "\t\tcr = cr.get_prev_sibling();",
1456 "\t//GLib.debug(\"row number is %d\", rn);",
1457 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1458 "\t// above or belw",
1459 "\tGraphene.Rect bounds;",
1460 "\trow.compute_bounds(this.el, out bounds);",
1461 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1462 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1463 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1465 "\tvar ypos = y - bounds.get_y();",
1466 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1467 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1468 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1469 "\tpos = \"over\";",
1471 "\tif (rpos > 80) {",
1472 "\t\tpos = \"below\";",
1473 "\t} else if (rpos < 20) {",
1474 "\t\tpos = \"above\";",
1480 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1482 "\tif (!_this.navigation_holder.el.visible) {",
1483 "\t\t_this.navigation_holder.el.show();",
1484 "\t\t_this.paned.el.position = ",
1485 "\t\t\t_this.paned.el.get_width() - 200;",
1487 "\t//_this.navliststore.el.remove_all();",
1490 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1492 "\tforeach(var sym in syms) {",
1493 "\t\tls.append(sym);",
1495 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1496 "\t//_this.navliststore.el.append(sym);",
1497 "\tthis.last_selected_line = -1;",
1498 "\tGLib.Idle.add(() => {",
1499 "\t\t_this.navigationsort.collapseOnLoad();",
1500 "\t\tGtk.TextIter iter;",
1501 "\t\t_this.buffer.el.get_iter_at_offset (",
1502 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1504 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1505 "\t\t\t\titer.get_line_offset());",
1506 "\t\tthis.updateSelectedLine(",
1507 "\t\t\t\t(uint)iter.get_line(),",
1508 "\t\t\t\t(uint)iter.get_line_offset()",
1510 "\t\treturn false;",
1515 "| void updateSelectedLine" : [
1516 "(uint line, uint chr) {",
1517 "\tif (line == this.last_selected_line) {",
1520 "\tGLib.debug(\"select line %d\", (int)line);",
1521 "\tthis.last_selected_line = (int)line;",
1524 "\tvar new_row = -1;",
1525 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1526 "\tif (sym != null) {",
1527 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1528 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1530 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1533 "\tif (this.selected_row != null) { ",
1534 "\t\tGLib.debug(\" remove selected row\");",
1535 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1537 "\tthis.selected_row = null;",
1538 "\tif (new_row > -1) {",
1539 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1540 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1541 "\t\tif (row != null) {",
1542 "\t\t\tGLib.debug(\" Add selected row\");",
1544 "\t\t\trow.add_css_class(\"selected-row\");",
1545 "\t\t\tthis.selected_row = row;",
1549 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1559 "xtype" : "ScrolledWindow"
1569 "| bool saveContents" : [
1573 " if (_this.file == null) {",
1579 " var str = _this.buffer.toString();",
1581 " _this.buffer.checkSyntax();",
1585 " // LeftPanel.model.changed( str , false);",
1586 " _this.dirty = false;",
1587 " _this.save_button.el.sensitive = false;",
1589 " // find the text for the node..",
1590 " if (_this.file.xtype != \"PlainFile\") {",
1591 " // in theory these properties have to exist!?!",
1592 " \tthis.prop.val = str;",
1593 " //this.window.windowstate.left_props.reload();",
1595 " _this.file.setSource( str );",
1598 " // call the signal..",
1606 "(string in_txt) {",
1608 "\tvar s = new GtkSource.SearchSettings();",
1609 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1610 "\ts.regex_enabled = _this.regex.el.active;\t",
1611 "\ts.wrap_around = false;",
1613 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1614 "\tthis.searchcontext.set_highlight(true);",
1615 "\tvar txt = in_txt;",
1617 "\tif (_this.multiline.el.active) {",
1618 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1621 "\ts.set_search_text(txt);",
1622 "\tGtk.TextIter beg, st,en;",
1624 "\tthis.buffer.el.get_start_iter(out beg);",
1625 "\tbool has_wrapped_around;",
1626 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1627 "\tthis.last_search_end = 0;",
1629 "\treturn this.searchcontext.get_occurrences_count();",
1637 "| string tempFileContents" : [
1641 " if (_this.file == null) {",
1644 "\tvar str= this.buffer.toString();",
1645 "\tif (_this.file.xtype == \"PlainFile\") {",
1653 " GLib.debug(\"calling validate\"); ",
1654 " // clear the buttons.",
1655 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1656 "\t\treturn this.file.toSource(); ;",
1659 "\tvar oldcode = _this.prop.val;",
1660 "\t_this.prop.val = str;",
1661 " var ret = _this.file.toSource();",
1662 " _this.prop.val = oldcode;",
1667 "| void backSearch" : [
1668 "(bool change_focus) {",
1670 "\tif (this.searchcontext == null) {",
1674 "\tGtk.TextIter beg, st,en;",
1675 "\tbool has_wrapped_around;",
1676 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1678 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1679 "\t\tthis.last_search_end = 0;",
1681 "\t\tthis.last_search_end = en.get_offset();",
1682 "\t\tif (change_focus) {",
1683 "\t\t\tthis.view.el.grab_focus();",
1685 "\t\tthis.buffer.el.place_cursor(st);",
1686 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1692 "| void forwardSearch" : [
1693 "(bool change_focus) {",
1695 "\tif (this.searchcontext == null) {",
1699 "\tGtk.TextIter beg, st,en;",
1700 "\t bool has_wrapped_around;",
1701 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1702 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1704 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1706 "\t\tif (has_wrapped_around) {",
1710 "\t\tthis.last_search_end = en.get_offset();",
1711 "\t\tif (change_focus) {",
1712 "\t\t\tthis.view.el.grab_focus();",
1714 "\t\tthis.buffer.el.place_cursor(st);",
1715 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1723 "\t this.file = null; ",
1725 " this.node = null;",
1726 " this.prop = null;",
1727 "\tthis.searchcontext = null;",
1732 "| void scroll_to_line" : [
1735 "\tGLib.Timeout.add(500, () => {",
1737 "\t\tvar buf = this.view.el.get_buffer();",
1739 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1742 "\t\tGtk.TextIter iter; ",
1743 "\t\tsbuf.get_iter_at_line(out iter, line);",
1744 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1745 "\t\treturn false;",
1751 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1754 " if (this.file != null) {",
1755 " \tthis.file.navigation_tree_updated.disconnect(",
1756 " \t\t_this.navigation.show",
1759 " this.file = file; ",
1760 " this.file.navigation_tree_updated.connect(",
1761 "\t\t_this.navigation.show",
1763 " if (file.xtype != \"PlainFile\") {",
1764 " \tthis.prop = prop;",
1765 " this.node = node;",
1767 " // find the text for the node..",
1768 " this.view.load( prop.val );",
1769 " this.updateErrorMarks();",
1773 " this.close_btn.el.show(); ",
1776 " this.view.load( file.toSource() );",
1777 " this.updateErrorMarks();",
1778 " this.close_btn.el.hide();",
1779 " var ls = file.getLanguageServer();",
1780 " ls.queueDocumentSymbols(file);",
1781 " ////ls.documentSymbols.begin(file, (a,o) => {",
1782 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1784 " //documentSymbols",
1790 "| void updateErrorMarks" : [
1795 "\tvar buf = _this.buffer.el;",
1796 "\tGtk.TextIter start;",
1797 "\tGtk.TextIter end; ",
1798 "\tbuf.get_bounds (out start, out end);",
1803 "\t//GLib.debug(\"highlight errors\");\t\t ",
1805 "\t // we should highlight other types of errors..",
1807 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1809 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1811 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1817 "\tif (_this.file == null) {",
1818 "\t\tGLib.debug(\"file is null?\");",
1822 "\tvar ar = this.file.getErrors();",
1823 "\tif (ar.size < 1) {",
1824 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1825 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1826 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1827 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1828 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1829 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1830 "\t\tthis.last_error_counter = file.error_counter ;",
1831 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1836 " // basicaly check if there is no change, then we do not do any update..",
1837 " // we can do this by just using an error counter?",
1838 " // if that's changed then we will do an update, otherwise dont bother.",
1841 "\tvar offset = 0;",
1842 "\tvar hoffset = 0;",
1844 "\tvar tlines = buf.get_line_count () +1;",
1846 "\tif (_this.prop != null) {",
1847 "\t\t// this still seems flaky...",
1849 "\t\ttlines = _this.prop.end_line;",
1850 "\t\toffset = _this.prop.start_line;",
1851 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1855 "\t\t// no update...",
1856 "\t\tif (this.last_error_counter == file.error_counter) {",
1862 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1863 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1864 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1865 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1866 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1867 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1869 "\tforeach(var diag in ar) { ",
1870 "\t Gtk.TextIter iter;",
1871 "// print(\"get inter\\n\");",
1872 "\t var eline = (int)diag.range.start.line - offset;",
1873 "\t var eline_to = (int)diag.range.end.line - offset;",
1874 "\t //var eline = diag.range.end_line - offset;",
1875 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1876 "\t //\terr.line ,eline, offset);",
1879 "\t if (eline > tlines || eline < 0) {",
1883 "\t buf.get_iter_at_line( out iter, eline);",
1884 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1885 "\t buf.create_source_mark( msg, diag.category, iter);",
1887 " \t var spos = (int)diag.range.start.character - hoffset;",
1888 " \t if (spos < 0) { spos =0 ; }",
1889 " \t if (spos > iter.get_chars_in_line()) {",
1890 " \t \tspos = iter.get_chars_in_line();",
1892 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1893 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1894 " \t if (epos < 0) { epos =0 ; }",
1895 " \t if (epos > iter.get_chars_in_line()) {",
1896 " \t \tepos = iter.get_chars_in_line();",
1900 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1902 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1904 "\t buf.apply_tag_by_name(diag.category, start, end);",
1906 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1907 "\t //this.marks.set(eline, msg);",
1909 "\tthis.last_error_counter = file.error_counter ;",