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 shrink_end_child" : false,
29 "int width_request" : 200,
33 "* prop" : "start_child",
34 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
38 "$ homogeneous" : false,
40 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
41 "bool hexpand" : true,
42 "bool vexpand" : false,
46 "bool vexpand" : true,
52 " _this.saveContents();",
61 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
65 "int margin_start" : 4,
68 "(Lsp.Hover? help) {",
69 "\tif (help == null || help.contents == null",
70 "\t\t|| help.contents.size < 1) {",
71 "\t\tthis.el.set_text(\"\");",
74 "\tvar sig = help.contents.get(0).value.split(\" \");",
75 "\tstring[] str = {};",
76 "\tfor(var i =0; i < sig.length; i++) {",
78 "\t\tswitch(sig[i]) {",
79 "\t\t\tcase \"public\":",
80 "\t\t\tcase \"private\":",
81 "\t\t\tcase \"protected\":",
82 "\t\t\tcase \"async\":",
83 "\t\t\tcase \"class\":",
89 "\t\t\t\tstr += sig[i];",
95 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
96 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
97 "\t\t\t\t\t+\"</span>\");",
101 "\tif (help.contents.size > 1) {",
102 "\t\tsig += (\"\\n\\n\" + help.contents[1].value);",
105 "\tthis.el.set_markup(string.joinv(\" \",str));",
112 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
115 "\t//this.el.set_range(6,30);",
116 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
117 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
119 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
120 " \t\t//\tGLib.debug(\"update range\");",
121 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
122 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
130 "Gtk.Align halign" : "Gtk.Align.END",
131 "bool draw_value" : false,
132 "bool has_origin" : true,
133 "bool sensitive" : true,
135 "int width_request" : 150,
139 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
142 " \tBuilderApplication.settings.editor_font_size = val;",
151 "Gtk.Align halign" : "Gtk.Align.END",
157 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
158 "string icon_name" : "window-close",
165 " _this.saveContents();",
166 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
171 "string icon_name" : "window-close",
179 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
180 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
181 "bool overlay_scrolling" : false,
182 "bool vexpand" : true,
183 "id" : "RightEditor",
186 "# Gtk.CssProvider css" : "null",
187 "$ gboolean auto_indent" : true,
188 "$ xns" : "GtkSource",
195 "this.el.completion.add_provider(",
196 "\tnew Palete.CompletionProvider(_this)",
199 "// hover seems pretty useless.. - ??",
200 "//var hover = this.el.get_hover();",
201 "//hover.add_provider(new Palete.HoverProvider(_this));",
203 "//this.el.completion.unblock_interactive();",
204 "this.el.completion.select_on_show = true; // select",
205 "//this.el.completion.remember_info_visibility\t = true;",
208 "var attrs = new GtkSource.MarkAttributes();",
210 "attrs.set_icon_name ( \"process-stop\"); ",
211 "attrs.query_tooltip_text.connect(( mark) => {",
212 " GLib.debug(\"tooltip query? %s\", mark.name);",
213 " return strdup( mark.name);",
215 " attrs.query_tooltip_markup.connect(( mark) => {",
216 " GLib.debug(\"tooltip query? %s\", mark.name);",
217 " return strdup( mark.name);",
219 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
223 "var wattrs = new GtkSource.MarkAttributes();",
224 "wattrs.set_icon_name ( \"process-stop\"); ",
225 "wattrs.query_tooltip_text.connect(( mark) => {",
226 " GLib.debug(\"tooltip query? %s\", mark.name);",
227 " return strdup(mark.name);",
229 "wattrs.query_tooltip_markup.connect(( mark) => {",
230 " GLib.debug(\"tooltip query? %s\", mark.name);",
231 " return strdup(mark.name);",
233 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
237 "var dattrs = new GtkSource.MarkAttributes();",
239 "dattrs.set_icon_name ( \"process-stop\"); ",
241 "dattrs.query_tooltip_text.connect(( mark) => {",
242 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
243 " return strdup(mark.name);",
245 "//dattrs.query_tooltip_markup.connect(( mark) => {",
246 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
247 " // return strdup(mark.name);",
249 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
252 " this.el.get_space_drawer().set_matrix(null);",
253 " this.el.get_space_drawer().set_types_for_locations( ",
254 "\tGtkSource.SpaceLocationFlags.ALL,",
255 "\tGtkSource.SpaceTypeFlags.ALL",
257 "this.el.get_space_drawer().set_enable_matrix(true);",
261 "bool has_tooltip" : true,
262 "bool hexpand" : true,
263 "bool insert_spaces_instead_of_tabs" : true,
264 "bool vexpand" : true,
265 "boolean show_line_marks" : true,
266 "boolean show_line_numbers" : true,
267 "css_classes" : "{ \"code-editor\" }",
268 "gboolean highlight_current_line" : true,
273 "$ Gee.HashMap<int,string>? xmarks" : "null",
274 "$ xns" : "GtkSource",
275 "$ xtype" : "Buffer",
278 "var buf = this.el;",
279 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
280 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
281 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
282 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
283 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
284 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
285 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
286 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
289 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
290 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
291 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
297 "bool check_queued" : false,
298 "bool enable_undo" : true,
299 "bool highlight_matching_brackets" : true,
300 "bool highlight_syntax" : true,
302 "int error_line" : "-1",
306 " // check syntax??",
308 " _this.save_button.el.sensitive = true;",
309 " print(\"EDITOR CHANGED\");",
310 " this.checkSyntax();",
312 " _this.dirty = true;",
314 " // this.get('/LeftPanel.model').changed( str , false);",
322 "\tGtk.TextIter iter;",
323 "\tthis.el.get_iter_at_offset (",
324 "\t\t\tout iter, this.el.cursor_position);",
326 "\t_this.navigation.updateSelectedLine(",
327 "\t\t\t(uint)iter.get_line(),",
328 "\t\t\t(uint)iter.get_line_offset()",
330 "\tthis.showHelp(iter);",
336 "| bool OLDhighlightErrorsJson" : [
337 "(string type, Json.Object obj) {",
338 "\tGtk.TextIter start;",
339 "\tGtk.TextIter end; ",
340 "\tthis.el.get_bounds (out start, out end);",
342 "\tthis.el.remove_source_marks (start, end, type);",
343 "\tGLib.debug(\"highlight errors\");\t\t ",
345 "\t // we should highlight other types of errors..",
347 "\tif (!obj.has_member(type)) {",
348 "\t\tGLib.debug(\"Return has no errors\\n\");",
352 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
354 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
356 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
361 "\t//this.marks = new Gee.HashMap<int,string>();",
362 "\tvar err = obj.get_object_member(type);",
364 "\tif (_this.file == null) {",
365 "\t\tGLib.debug(\"file is null?\");",
369 "\tvar valafn = _this.file.path;",
371 "\tif (_this.file.xtype != \"PlainFile\") {",
373 "\t\tvalafn = \"\";",
375 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
376 "\t\t\t// should not happen",
377 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
378 "\t\t} catch (GLib.RegexError e) {",
379 "\t\t\treturn true;",
385 "\tif (!err.has_member(valafn)) {",
386 "\t\tGLib.debug(\"File path has no errors\");",
390 "\tvar lines = err.get_object_member(valafn);",
393 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
394 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
398 "\tvar tlines = this.el.get_line_count () +1;",
400 "\tif (_this.prop != null) {",
402 "\t\ttlines = _this.prop.end_line + 1;",
403 "\t\toffset = _this.prop.start_line + 1;",
409 "\tlines.foreach_member((obj, line, node) => {",
411 "\t Gtk.TextIter iter;",
412 "// print(\"get inter\\n\");",
413 "\t var eline = int.parse(line) - offset;",
414 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
417 "\t if (eline > tlines || eline < 0) {",
422 "\t this.el.get_iter_at_line( out iter, eline);",
423 "\t //print(\"mark line\\n\");",
424 "\t var msg = \"\";",
425 "\t var ar = lines.get_array_member(line);",
426 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
427 "\t \tif (ar.get_string_element(i) == \"Success\") {",
430 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
431 "\t\t\tmsg += ar.get_string_element(i);",
433 "\t\tif (msg == \"\") {",
436 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
437 "\t this.el.create_source_mark(msg, type, iter);",
438 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
439 "\t // this.marks.set(eline, msg);",
450 "| bool checkSyntax" : [
454 " var str = this.toString();",
457 " if (this.error_line > 0) {",
458 " Gtk.TextIter start;",
459 " Gtk.TextIter end; ",
460 " this.el.get_bounds (out start, out end);",
462 " this.el.remove_source_marks (start, end, null);",
464 " if (str.length < 1) {",
465 " print(\"checkSyntax - empty string?\\n\");",
469 " // bit presumptiona",
470 " if (_this.file.xtype == \"PlainFile\") {",
472 " // assume it's gtk...",
473 " var oldcode =_this.file.toSource();",
474 " _this.file.setSource(str);",
475 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
476 " \t_this.file.getLanguageServer().document_change(_this.file);",
477 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
478 " _this.file.setSource(oldcode);",
484 " if (_this.file == null) {",
492 " GLib.debug(\"calling validate\"); ",
493 " // clear the buttons.",
494 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
497 "\tvar oldcode = _this.prop.val;",
499 "\t_this.prop.val = str;",
500 "\t_this.node.updated_count++;",
501 " _this.file.getLanguageServer().document_change(_this.file);",
502 " _this.node.updated_count++;",
503 " _this.prop.val = oldcode;",
506 " //print(\"done mark line\\n\");",
508 " return true; // at present allow saving - even if it's invalid..",
512 "| bool highlightErrors" : [
513 "( Gee.HashMap<int,string> validate_res) {",
515 "\tthis.error_line = validate_res.size;",
517 "\tif (this.error_line < 1) {",
520 "\tvar tlines = this.el.get_line_count ();",
521 "\tGtk.TextIter iter;",
522 "\tvar valiter = validate_res.map_iterator();",
523 "\twhile (valiter.next()) {",
525 "\t// print(\"get inter\\n\");",
526 "\t\tvar eline = valiter.get_key();",
527 "\t\tif (eline > tlines) {",
530 "\t\tthis.el.get_iter_at_line( out iter, eline);",
531 "\t\t//print(\"mark line\\n\");",
532 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
537 "| string toString" : [
542 " this.el.get_start_iter(out s);",
543 " this.el.get_end_iter(out e);",
544 " var ret = this.el.get_text(s,e,true);",
545 " //print(\"TO STRING? \" + ret);",
550 "| void showHelp" : [
551 "(Gtk.TextIter iter) {",
552 "\tvar back = iter.copy();",
553 "\tback.backward_char();",
555 "\tvar forward = iter.copy();",
556 "\tforward.forward_char();",
558 "\t// what's the character at the iter?",
559 "\tvar str = back.get_text(iter);",
560 "\tstr += iter.get_text(forward);",
561 "\tif (str.strip().length < 1) {",
564 "\tvar offset = iter.get_line_offset();",
565 "\tvar line = iter.get_line();",
566 "\tif (_this.prop != null) {",
568 "\t\tline += _this.prop.start_line ; ",
569 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
570 "\t\toffset += _this.node.node_pad.length;",
571 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
572 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
573 "\t\t\toffset += 2;",
577 "\tvar ls = _this.file.getLanguageServer();",
579 "\t\t_this.file, line, offset,",
582 "\t\t\t\tvar res = ls.hover.end(o );",
584 "\t\t\t\t_this.helper.setHelp(res);",
585 "\t\t\t} catch (GLib.Error e) {",
595 "# bool is_control" : false,
600 "(keyval, keycode, state) => {",
602 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
603 " \t\tthis.is_control = true;",
610 "(keyval, keycode, state) => {",
612 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
613 " \t\tthis.is_control = false;",
615 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
616 " GLib.debug(\"SAVE: ctrl-S pressed\");",
617 " _this.saveContents();",
621 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
622 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
623 "\t\t_this.forwardSearch(true);",
626 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
627 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
628 "\t\t_this.search_entry.el.grab_focus();",
629 "\t\t_this.search_entry.el.select_region(0,-1);",
632 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
633 "\t\t_this.view.el.show_completion();",
636 "\tGtk.TextIter iter;",
637 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
638 "\tvar line = iter.get_line();",
639 "\tvar offset = iter.get_line_offset();",
640 "\tGLib.debug(\"line %d off %d\", line ,offset);",
641 "\tif (_this.prop != null) {",
642 "\t\tline += _this.prop.start_line + 1; // i think..",
643 "\t\toffset += 12; // should probably be 8 without namespaced ",
644 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
646 " //_this.view.el.show_completion();",
647 " // print(event.key.keyval)",
657 "xtype" : "EventControllerKey"
660 "# double distance" : "0.0f",
662 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
666 "\tif (!_this.keystate.is_control) {",
669 "\t //GLib.debug(\"scroll %f\", dy);",
671 "\tthis.distance += dy;",
673 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
675 "\t if (this.distance < -1) {",
677 "\t\tBuilderApplication.settings.editor_font_size ++;",
678 "\t\tthis.distance = 0;",
680 "\tif (this.distance > 1) {",
681 "\t\tBuilderApplication.settings.editor_font_size --;",
682 "\t\tthis.distance = 0;",
690 "xtype" : "EventControllerScroll"
696 "(n_press, x, y) => {",
697 "\tGtk.TextIter iter;",
698 "\tint buffer_x, buffer_y;",
699 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
701 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
702 "\t\t(int)x - gut.get_width(), (int)y,",
703 " \t\tout buffer_x, out buffer_y);",
704 "\t_this.view.el.get_iter_at_location (out iter, ",
705 "\t\t\tbuffer_x, buffer_y);;",
708 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
709 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
713 "\t_this.buffer.showHelp(iter);",
721 "xtype" : "GestureClick"
726 "(x, y, keyboard_tooltip, tooltip) => {",
728 "\t//GLib.debug(\"query tooltip\");",
729 "\tGtk.TextIter iter;",
732 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
734 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
736 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
737 "\t//\treturn false;",
740 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
742 "\tvar l = iter.get_line();",
746 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
752 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
753 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
754 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
762 "\t// this crashes?? - not sure why.",
763 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
764 "\tif (marks.is_empty()) {",
765 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
767 "\tif (marks.is_empty()) {",
768 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
771 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
773 "\tmarks.@foreach((m) => { ",
774 "\t\t//GLib.debug(\"got mark %s\", m.name);",
775 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
777 "\t// true if there is a mark..",
778 "\tif (str.length > 0 ) {",
779 "\t\ttooltip.set_text( str );",
781 "\treturn str.length > 0 ? true : false;",
787 "string name" : "editor-view",
788 "uint tab_width" : 4,
793 "// show the help page for the active node..",
794 " //this.get('/Help').show();",
796 " // this.get('/BottomPane').el.set_current_page(0);",
797 " \tGLib.debug(\"load called - Reset undo buffer\");",
799 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
800 " buf.begin_irreversible_action();",
801 " buf.set_text(str, str.length);",
802 " buf.end_irreversible_action();",
804 " var lm = GtkSource.LanguageManager.get_default();",
805 " var lang = \"vala\";",
806 " if (_this.file != null) {",
807 " lang = _this.file.language;",
809 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
810 " var lg = _this.file.content_type.length > 0 ?",
811 " lm.guess_language(_this.file.path, _this.file.content_type) :",
812 " lm.get_language(lang);",
815 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
817 " this.el.insert_spaces_instead_of_tabs = true;",
818 " if (lg != null) {",
819 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
820 "\t\tif (lg.name == \"Vala\") {",
821 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
824 " _this.dirty = false;",
825 " this.el.grab_focus();",
826 " _this.save_button.el.sensitive = false;",
827 " _this.last_error_counter = -1;",
832 "xtype" : "ScrolledWindow"
837 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
838 "bool homogeneous" : false,
839 "bool vexpand" : false,
844 "Gtk.CssProvider css" : "",
845 "bool hexpand" : true,
846 "id" : "search_entry",
852 "(keyval, keycode, state) => {",
854 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
855 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
856 "\t\t_this.forwardSearch(true);",
861 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
862 "\t\t_this.forwardSearch(true);",
868 " // print(event.key.keyval)",
875 "xtype" : "EventControllerKey"
882 "_this.search(_this.search_entry.el.text);",
883 "\t _this.search_results.updateResults();",
885 "\tGLib.Timeout.add_seconds(1,() => {",
886 "\t\t _this.search_results.updateResults();",
887 "\t\t return false;",
893 "string name" : "editor-search-entry",
894 "string placeholder_text" : "Press enter to search",
895 "uint search_delay" : 3,
896 "xtype" : "SearchEntry",
897 "| void forwardSearch" : [
898 "(bool change_focus) {",
901 "\t_this.forwardSearch(change_focus);",
905 "\tswitch(_this.windowstate.state) {",
906 "\t\tcase WindowState.State.CODEONLY:",
907 "\t\t//case WindowState.State.CODE:",
908 "\t\t\t// search the code being edited..",
909 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
912 "\t\tcase WindowState.State.PREVIEW:",
913 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
914 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
916 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
929 "id" : "search_results",
930 "int margin_end" : 4,
931 "int margin_start" : 4,
932 "string label" : "No Results",
934 "| void updateResults" : [
936 "\tthis.el.visible = true;",
938 "\tvar res = _this.searchcontext.get_occurrences_count();",
940 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
944 "\t_this.nextBtn.el.sensitive = false;",
945 "\t_this.backBtn.el.sensitive = false;\t",
948 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
949 "\t\t_this.nextBtn.el.sensitive = true;",
950 "\t\t_this.backBtn.el.sensitive = true;",
953 "\t_this.search_results.el.label = \"No Matches\";",
960 "bool always_show_image" : true,
961 "bool sensitive" : false,
967 "\t_this.forwardSearch(true);",
974 "string icon_name" : "go-down",
979 "bool always_show_image" : true,
980 "bool sensitive" : false,
986 "\t_this.backSearch(true);",
992 "string icon_name" : "go-up",
997 "bool always_show_arrow" : true,
998 "bool always_show_image" : true,
1002 "* prop" : "popover",
1003 "id" : "search_settings",
1008 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1015 "\tthis.el.show();",
1019 "id" : "case_sensitive",
1020 "string label" : "Case Sensitive",
1021 "xtype" : "CheckButton"
1027 "\tthis.el.show();",
1032 "string label" : "Regex",
1033 "xtype" : "CheckButton"
1038 "string label" : "Multi-line (add \\n)",
1039 "xtype" : "CheckButton"
1048 "string icon_name" : "emblem-system",
1049 "xtype" : "MenuButton"
1059 "* prop" : "end_child",
1060 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1061 "bool hexpand" : true,
1062 "bool vexpand" : true,
1067 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1073 "bool hexpand" : true,
1074 "bool vexpand" : true,
1075 "bool visible" : false,
1076 "id" : "navigationwindow",
1079 "# int last_selected_line" : "-1",
1080 "$ Gtk.Widget? selected_row" : "null",
1083 "id" : "navigation",
1087 "bool expand" : true,
1091 "* prop" : "factory",
1096 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1098 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1099 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1102 "\tvar hbox = (Gtk.Box) expand.child;",
1105 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1106 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1108 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1109 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1111 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1112 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1114 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1116 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1118 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1119 " \texpand.set_list_row(lr);",
1120 " \t//this.in_bind = true;",
1121 " \t// default is to expand",
1123 " \t//this.in_bind = false;",
1125 " \tsym.bind_property(\"symbol_icon\",",
1126 " img, \"icon_name\",",
1127 " GLib.BindingFlags.SYNC_CREATE);",
1129 " \thbox.css_classes = { sym.symbol_icon };",
1131 " \tsym.bind_property(\"name\",",
1133 " GLib.BindingFlags.SYNC_CREATE);",
1134 " \t// should be better?- --line no?",
1135 " \tsym.bind_property(\"tooltip\",",
1136 " lbl, \"tooltip_markup\",",
1137 " GLib.BindingFlags.SYNC_CREATE);",
1138 " \t// bind image...",
1146 "\tvar expand = new Gtk.TreeExpander();",
1148 "\texpand.set_indent_for_depth(true);",
1149 "\texpand.set_indent_for_icon(true);",
1150 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1151 "\tvar icon = new Gtk.Image();",
1152 "\tvar lbl = new Gtk.Label(\"\");",
1153 "\tlbl.use_markup = true;",
1154 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1156 "\ticon.margin_end = 4;",
1157 " \tlbl.justify = Gtk.Justification.LEFT;",
1158 " \tlbl.xalign = 0;",
1160 "//\tlistitem.activatable = true; ??",
1162 "\thbox.append(icon);",
1163 "\thbox.append(lbl);",
1164 "\texpand.set_child(hbox);",
1165 "\t((Gtk.ListItem)listitem).set_child(expand);",
1171 "xtype" : "SignalListItemFactory"
1174 "string title" : "Code Navigation",
1175 "xtype" : "ColumnViewColumn"
1180 "id" : "navigationselmodel",
1185 "id" : "navigationsort",
1188 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1191 "\treturn ((Lsp.DocumentSymbol)item).children;",
1197 "bool autoexpand" : true,
1198 "bool passthrough" : false,
1201 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1204 "id" : "navliststore",
1205 "xtype" : "ListStore",
1206 "| Lsp.DocumentSymbol? symbolAtLine" : [
1207 "(uint line, uint chr) {",
1210 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1211 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1212 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1213 "\t\t//\tel.name , (int)el.range.start.line,",
1214 "\t\t//\t(int)el.range.end.line",
1216 "\t\tvar ret = el.containsLine(line,chr);",
1217 "\t\tif (ret != null) {",
1218 "\t\t\treturn ret;",
1230 "(position, removed, added) => {",
1231 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1232 "\t if (added < 1) { ",
1235 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1236 "\tvar row = this.el.get_row(position);",
1238 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1245 "xtype" : "TreeListModel"
1249 "* prop" : "sorter",
1253 "* prop" : "sorter",
1256 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1258 "* prop" : "expression",
1259 "string property_name" : "sort_key",
1260 "xtype" : "PropertyExpression"
1263 "xtype" : "StringSorter"
1266 "xtype" : "TreeListRowSorter"
1269 "xtype" : "SortListModel",
1270 "| Lsp.DocumentSymbol? getSymbolAt" : [
1273 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1275 " var a = tr.get_item();; ",
1276 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1279 " return (Lsp.DocumentSymbol)tr.get_item();",
1283 "| int getRowFromSymbol" : [
1284 "(Lsp.DocumentSymbol sym) {",
1286 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1287 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1289 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1296 "| void collapseOnLoad" : [
1298 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1299 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1300 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1301 "\t\tswitch (sym.kind) {",
1302 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1303 "\t \t\t\ttr.expanded = false;",
1306 "\t\t\t\t//tr.expanded = true;",
1318 "xtype" : "NoSelection"
1324 "(n_press, x, y) => {",
1326 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1328 " if (row == null) {",
1329 "\t GLib.debug(\"no row selected items\");",
1332 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1333 " //Lsp.DocumentSymbol",
1334 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1335 " if (sym == null) {",
1341 " \"line\" : 1410,",
1342 " \"character\" : 8",
1345 " \"line\" : 1410,",
1346 " \"character\" : 39",
1350 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1351 " _this.scroll_to_line((int)sym.range.start.line);",
1352 " Gtk.TextIter iter;",
1353 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1354 " \t(int)sym.range.start.line,",
1355 " \t(int)sym.range.start.character",
1357 " _this.buffer.el.place_cursor(iter);",
1362 "xtype" : "GestureClick"
1365 "string name" : "editor-navigation",
1366 "xtype" : "ColumnView",
1367 "| Gtk.Widget? getRowWidgetAt" : [
1368 "(double x, double y, out string pos) {",
1371 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1372 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1373 "\tif (w == null) {",
1377 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1378 "\tif (row == null) {",
1382 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1386 "\t//GLib.debug(\"row number is %d\", rn);",
1387 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1388 "\t// above or belw",
1389 "\tGraphene.Rect bounds;",
1390 "\trow.compute_bounds(this.el, out bounds);",
1391 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1392 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1393 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1395 "\tvar ypos = y - bounds.get_y();",
1396 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1397 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1398 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1399 "\tpos = \"over\";",
1401 "\tif (rpos > 80) {",
1402 "\t\tpos = \"below\";",
1403 "\t} else if (rpos < 20) {",
1404 "\t\tpos = \"above\";",
1409 "| int getRowAt" : [
1410 "(double x, double y, out string pos) {",
1413 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1414 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1415 "\tif (w == null) {",
1419 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1420 "\tif (row == null) {",
1424 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1429 "\twhile (cr.get_prev_sibling() != null) {",
1431 "\t\tcr = cr.get_prev_sibling();",
1434 "\t//GLib.debug(\"row number is %d\", rn);",
1435 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1436 "\t// above or belw",
1437 "\tGraphene.Rect bounds;",
1438 "\trow.compute_bounds(this.el, out bounds);",
1439 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1440 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1441 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1443 "\tvar ypos = y - bounds.get_y();",
1444 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1445 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1446 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1447 "\tpos = \"over\";",
1449 "\tif (rpos > 80) {",
1450 "\t\tpos = \"below\";",
1451 "\t} else if (rpos < 20) {",
1452 "\t\tpos = \"above\";",
1458 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1459 "\t_this.navigationwindow.el.show();",
1460 "\t//_this.navliststore.el.remove_all();",
1463 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1465 "\tforeach(var sym in syms) {",
1466 "\t\tls.append(sym);",
1468 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1469 "\t//_this.navliststore.el.append(sym);",
1470 "\tthis.last_selected_line = -1;",
1471 "\tGLib.Idle.add(() => {",
1472 "\t\t_this.navigationsort.collapseOnLoad();",
1473 "\t\tGtk.TextIter iter;",
1474 "\t\t_this.buffer.el.get_iter_at_offset (",
1475 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1477 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1478 "\t\t\t\titer.get_line_offset());",
1479 "\t\tthis.updateSelectedLine(",
1480 "\t\t\t\t(uint)iter.get_line(),",
1481 "\t\t\t\t(uint)iter.get_line_offset()",
1483 "\t\treturn false;",
1488 "| void updateSelectedLine" : [
1489 "(uint line, uint chr) {",
1490 "\tif (line == this.last_selected_line) {",
1493 "\tGLib.debug(\"select line %d\", (int)line);",
1494 "\tthis.last_selected_line = (int)line;",
1497 "\tvar new_row = -1;",
1498 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1499 "\tif (sym != null) {",
1500 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1501 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1503 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1506 "\tif (this.selected_row != null) { ",
1507 "\t\tGLib.debug(\" remove selected row\");",
1508 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1510 "\tthis.selected_row = null;",
1511 "\tif (new_row > -1) {",
1512 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1513 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1514 "\t\tif (row != null) {",
1515 "\t\t\tGLib.debug(\" Add selected row\");",
1517 "\t\t\trow.add_css_class(\"selected-row\");",
1518 "\t\t\tthis.selected_row = row;",
1522 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1532 "xtype" : "ScrolledWindow"
1542 "| bool saveContents" : [
1546 " if (_this.file == null) {",
1552 " var str = _this.buffer.toString();",
1554 " _this.buffer.checkSyntax();",
1558 " // LeftPanel.model.changed( str , false);",
1559 " _this.dirty = false;",
1560 " _this.save_button.el.sensitive = false;",
1562 " // find the text for the node..",
1563 " if (_this.file.xtype != \"PlainFile\") {",
1564 " // in theory these properties have to exist!?!",
1565 " \tthis.prop.val = str;",
1566 " //this.window.windowstate.left_props.reload();",
1568 " _this.file.setSource( str );",
1571 " // call the signal..",
1579 "(string in_txt) {",
1581 "\tvar s = new GtkSource.SearchSettings();",
1582 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1583 "\ts.regex_enabled = _this.regex.el.active;\t",
1584 "\ts.wrap_around = false;",
1586 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1587 "\tthis.searchcontext.set_highlight(true);",
1588 "\tvar txt = in_txt;",
1590 "\tif (_this.multiline.el.active) {",
1591 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1594 "\ts.set_search_text(txt);",
1595 "\tGtk.TextIter beg, st,en;",
1597 "\tthis.buffer.el.get_start_iter(out beg);",
1598 "\tbool has_wrapped_around;",
1599 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1600 "\tthis.last_search_end = 0;",
1602 "\treturn this.searchcontext.get_occurrences_count();",
1610 "| string tempFileContents" : [
1614 " if (_this.file == null) {",
1617 "\tvar str= this.buffer.toString();",
1618 "\tif (_this.file.xtype == \"PlainFile\") {",
1626 " GLib.debug(\"calling validate\"); ",
1627 " // clear the buttons.",
1628 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1629 "\t\treturn this.file.toSource(); ;",
1632 "\tvar oldcode = _this.prop.val;",
1633 "\t_this.prop.val = str;",
1634 " var ret = _this.file.toSource();",
1635 " _this.prop.val = oldcode;",
1640 "| void backSearch" : [
1641 "(bool change_focus) {",
1643 "\tif (this.searchcontext == null) {",
1647 "\tGtk.TextIter beg, st,en;",
1648 "\tbool has_wrapped_around;",
1649 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1651 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1652 "\t\tthis.last_search_end = 0;",
1654 "\t\tthis.last_search_end = en.get_offset();",
1655 "\t\tif (change_focus) {",
1656 "\t\t\tthis.view.el.grab_focus();",
1658 "\t\tthis.buffer.el.place_cursor(st);",
1659 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1665 "| void forwardSearch" : [
1666 "(bool change_focus) {",
1668 "\tif (this.searchcontext == null) {",
1672 "\tGtk.TextIter beg, st,en;",
1673 "\t bool has_wrapped_around;",
1674 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1675 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1677 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1679 "\t\tif (has_wrapped_around) {",
1683 "\t\tthis.last_search_end = en.get_offset();",
1684 "\t\tif (change_focus) {",
1685 "\t\t\tthis.view.el.grab_focus();",
1687 "\t\tthis.buffer.el.place_cursor(st);",
1688 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1696 "\t this.file = null; ",
1698 " this.node = null;",
1699 " this.prop = null;",
1700 "\tthis.searchcontext = null;",
1705 "| void scroll_to_line" : [
1708 "\tGLib.Timeout.add(500, () => {",
1710 "\t\tvar buf = this.view.el.get_buffer();",
1712 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1715 "\t\tGtk.TextIter iter; ",
1716 "\t\tsbuf.get_iter_at_line(out iter, line);",
1717 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1718 "\t\treturn false;",
1724 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1727 " if (this.file != null) {",
1728 " \tthis.file.navigation_tree_updated.disconnect(",
1729 " \t\t_this.navigation.show",
1732 " this.file = file; ",
1733 " this.file.navigation_tree_updated.connect(",
1734 "\t\t_this.navigation.show",
1736 " if (file.xtype != \"PlainFile\") {",
1737 " \tthis.prop = prop;",
1738 " this.node = node;",
1740 " // find the text for the node..",
1741 " this.view.load( prop.val );",
1742 " this.updateErrorMarks();",
1746 " this.close_btn.el.show(); ",
1749 " this.view.load( file.toSource() );",
1750 " this.updateErrorMarks();",
1751 " this.close_btn.el.hide();",
1752 " var ls = file.getLanguageServer();",
1753 " ls.queueDocumentSymbols(file);",
1754 " ////ls.documentSymbols.begin(file, (a,o) => {",
1755 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1757 " //documentSymbols",
1763 "| void updateErrorMarks" : [
1768 "\tvar buf = _this.buffer.el;",
1769 "\tGtk.TextIter start;",
1770 "\tGtk.TextIter end; ",
1771 "\tbuf.get_bounds (out start, out end);",
1776 "\t//GLib.debug(\"highlight errors\");\t\t ",
1778 "\t // we should highlight other types of errors..",
1780 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1782 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1784 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1790 "\tif (_this.file == null) {",
1791 "\t\tGLib.debug(\"file is null?\");",
1795 "\tvar ar = this.file.getErrors();",
1796 "\tif (ar.size < 1) {",
1797 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1798 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1799 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1800 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1801 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1802 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1803 "\t\tthis.last_error_counter = file.error_counter ;",
1804 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1809 " // basicaly check if there is no change, then we do not do any update..",
1810 " // we can do this by just using an error counter?",
1811 " // if that's changed then we will do an update, otherwise dont bother.",
1814 "\tvar offset = 0;",
1815 "\tvar hoffset = 0;",
1817 "\tvar tlines = buf.get_line_count () +1;",
1819 "\tif (_this.prop != null) {",
1820 "\t\t// this still seems flaky...",
1822 "\t\ttlines = _this.prop.end_line;",
1823 "\t\toffset = _this.prop.start_line;",
1824 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1828 "\t\t// no update...",
1829 "\t\tif (this.last_error_counter == file.error_counter) {",
1835 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1836 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1837 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1838 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1839 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1840 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1842 "\tforeach(var diag in ar) { ",
1843 "\t Gtk.TextIter iter;",
1844 "// print(\"get inter\\n\");",
1845 "\t var eline = (int)diag.range.start.line - offset;",
1846 "\t var eline_to = (int)diag.range.end.line - offset;",
1847 "\t //var eline = diag.range.end_line - offset;",
1848 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1849 "\t //\terr.line ,eline, offset);",
1852 "\t if (eline > tlines || eline < 0) {",
1856 "\t buf.get_iter_at_line( out iter, eline);",
1857 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1858 "\t buf.create_source_mark( msg, diag.category, iter);",
1860 " \t var spos = (int)diag.range.start.character - hoffset;",
1861 " \t if (spos < 0) { spos =0 ; }",
1862 " \t if (spos > iter.get_chars_in_line()) {",
1863 " \t \tspos = iter.get_chars_in_line();",
1865 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1866 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1867 " \t if (epos < 0) { epos =0 ; }",
1868 " \t if (epos > iter.get_chars_in_line()) {",
1869 " \t \tepos = iter.get_chars_in_line();",
1873 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1875 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1877 "\t buf.apply_tag_by_name(diag.category, start, end);",
1879 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1880 "\t //this.marks.set(eline, msg);",
1882 "\tthis.last_error_counter = file.error_counter ;",