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 "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);",
75 "\tlbl.width_request = 700;",
76 "\ttooltip.set_custom(lbl);",
85 "(Lsp.Hover? help) {",
86 "\tif (help == null || help.contents == null",
87 "\t\t|| help.contents.size < 1) {",
88 "\t\tthis.el.set_text(\"\");",
91 "\tvar sig = help.contents.get(0).value.split(\" \");",
92 "\tstring[] str = {};",
93 "\tfor(var i =0; i < sig.length; i++) {",
95 "\t\tswitch(sig[i]) {",
96 "\t\t\tcase \"public\":",
97 "\t\t\tcase \"private\":",
98 "\t\t\tcase \"protected\":",
99 "\t\t\tcase \"async\":",
100 "\t\t\tcase \"class\":",
106 "\t\t\t\tstr += sig[i];",
112 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
113 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
114 "\t\t\t\t\t+\"</span>\");",
118 "\tif (help.contents.size > 1) {",
119 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
122 "\tthis.el.set_markup(string.joinv(\" \",str));",
129 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
132 "\t//this.el.set_range(6,30);",
133 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
134 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
136 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
137 " \t\t//\tGLib.debug(\"update range\");",
138 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
139 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
147 "Gtk.Align halign" : "Gtk.Align.END",
148 "bool draw_value" : false,
149 "bool has_origin" : true,
150 "bool sensitive" : true,
152 "int width_request" : 150,
156 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
159 " \tBuilderApplication.settings.editor_font_size = val;",
168 "Gtk.Align halign" : "Gtk.Align.END",
174 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
175 "string icon_name" : "window-close",
182 " _this.saveContents();",
183 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
188 "string icon_name" : "window-close",
196 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
197 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
198 "bool overlay_scrolling" : false,
199 "bool vexpand" : true,
200 "id" : "RightEditor",
203 "# Gtk.CssProvider css" : "null",
204 "$ gboolean auto_indent" : true,
205 "$ xns" : "GtkSource",
212 "this.el.completion.add_provider(",
213 "\tnew Palete.CompletionProvider(_this)",
216 "// hover seems pretty useless.. - ??",
217 "//var hover = this.el.get_hover();",
218 "//hover.add_provider(new Palete.HoverProvider(_this));",
220 "//this.el.completion.unblock_interactive();",
221 "this.el.completion.select_on_show = true; // select",
222 "//this.el.completion.remember_info_visibility\t = true;",
225 "var attrs = new GtkSource.MarkAttributes();",
227 "attrs.set_icon_name ( \"process-stop\"); ",
228 "attrs.query_tooltip_text.connect(( mark) => {",
229 " GLib.debug(\"tooltip query? %s\", mark.name);",
230 " return strdup( mark.name);",
232 " attrs.query_tooltip_markup.connect(( mark) => {",
233 " GLib.debug(\"tooltip query? %s\", mark.name);",
234 " return strdup( mark.name);",
236 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
240 "var wattrs = new GtkSource.MarkAttributes();",
241 "wattrs.set_icon_name ( \"process-stop\"); ",
242 "wattrs.query_tooltip_text.connect(( mark) => {",
243 " GLib.debug(\"tooltip query? %s\", mark.name);",
244 " return strdup(mark.name);",
246 "wattrs.query_tooltip_markup.connect(( mark) => {",
247 " GLib.debug(\"tooltip query? %s\", mark.name);",
248 " return strdup(mark.name);",
250 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
254 "var dattrs = new GtkSource.MarkAttributes();",
256 "dattrs.set_icon_name ( \"process-stop\"); ",
258 "dattrs.query_tooltip_text.connect(( mark) => {",
259 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
260 " return strdup(mark.name);",
262 "//dattrs.query_tooltip_markup.connect(( mark) => {",
263 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
264 " // return strdup(mark.name);",
266 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
269 " this.el.get_space_drawer().set_matrix(null);",
270 " this.el.get_space_drawer().set_types_for_locations( ",
271 "\tGtkSource.SpaceLocationFlags.ALL,",
272 "\tGtkSource.SpaceTypeFlags.ALL",
274 "this.el.get_space_drawer().set_enable_matrix(true);",
278 "bool has_tooltip" : true,
279 "bool hexpand" : true,
280 "bool insert_spaces_instead_of_tabs" : true,
281 "bool vexpand" : true,
282 "boolean show_line_marks" : true,
283 "boolean show_line_numbers" : true,
284 "css_classes" : "{ \"code-editor\" }",
285 "gboolean highlight_current_line" : true,
290 "$ Gee.HashMap<int,string>? xmarks" : "null",
291 "$ xns" : "GtkSource",
292 "$ xtype" : "Buffer",
295 "var buf = this.el;",
296 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
297 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
298 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
299 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
300 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
301 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
302 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
303 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
306 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
307 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
308 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
314 "bool check_queued" : false,
315 "bool enable_undo" : true,
316 "bool highlight_matching_brackets" : true,
317 "bool highlight_syntax" : true,
319 "int error_line" : "-1",
323 " // check syntax??",
325 " _this.save_button.el.sensitive = true;",
326 " print(\"EDITOR CHANGED\");",
327 " this.checkSyntax();",
329 " _this.dirty = true;",
331 " // this.get('/LeftPanel.model').changed( str , false);",
339 "\tGtk.TextIter iter;",
340 "\tthis.el.get_iter_at_offset (",
341 "\t\t\tout iter, this.el.cursor_position);",
343 "\t_this.navigation.updateSelectedLine(",
344 "\t\t\t(uint)iter.get_line(),",
345 "\t\t\t(uint)iter.get_line_offset()",
347 "\tthis.showHelp(iter);",
353 "| bool OLDhighlightErrorsJson" : [
354 "(string type, Json.Object obj) {",
355 "\tGtk.TextIter start;",
356 "\tGtk.TextIter end; ",
357 "\tthis.el.get_bounds (out start, out end);",
359 "\tthis.el.remove_source_marks (start, end, type);",
360 "\tGLib.debug(\"highlight errors\");\t\t ",
362 "\t // we should highlight other types of errors..",
364 "\tif (!obj.has_member(type)) {",
365 "\t\tGLib.debug(\"Return has no errors\\n\");",
369 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
371 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
373 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
378 "\t//this.marks = new Gee.HashMap<int,string>();",
379 "\tvar err = obj.get_object_member(type);",
381 "\tif (_this.file == null) {",
382 "\t\tGLib.debug(\"file is null?\");",
386 "\tvar valafn = _this.file.path;",
388 "\tif (_this.file.xtype != \"PlainFile\") {",
390 "\t\tvalafn = \"\";",
392 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
393 "\t\t\t// should not happen",
394 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
395 "\t\t} catch (GLib.RegexError e) {",
396 "\t\t\treturn true;",
402 "\tif (!err.has_member(valafn)) {",
403 "\t\tGLib.debug(\"File path has no errors\");",
407 "\tvar lines = err.get_object_member(valafn);",
410 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
411 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
415 "\tvar tlines = this.el.get_line_count () +1;",
417 "\tif (_this.prop != null) {",
419 "\t\ttlines = _this.prop.end_line + 1;",
420 "\t\toffset = _this.prop.start_line + 1;",
426 "\tlines.foreach_member((obj, line, node) => {",
428 "\t Gtk.TextIter iter;",
429 "// print(\"get inter\\n\");",
430 "\t var eline = int.parse(line) - offset;",
431 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
434 "\t if (eline > tlines || eline < 0) {",
439 "\t this.el.get_iter_at_line( out iter, eline);",
440 "\t //print(\"mark line\\n\");",
441 "\t var msg = \"\";",
442 "\t var ar = lines.get_array_member(line);",
443 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
444 "\t \tif (ar.get_string_element(i) == \"Success\") {",
447 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
448 "\t\t\tmsg += ar.get_string_element(i);",
450 "\t\tif (msg == \"\") {",
453 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
454 "\t this.el.create_source_mark(msg, type, iter);",
455 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
456 "\t // this.marks.set(eline, msg);",
467 "| bool checkSyntax" : [
471 " var str = this.toString();",
474 " if (this.error_line > 0) {",
475 " Gtk.TextIter start;",
476 " Gtk.TextIter end; ",
477 " this.el.get_bounds (out start, out end);",
479 " this.el.remove_source_marks (start, end, null);",
481 " if (str.length < 1) {",
482 " print(\"checkSyntax - empty string?\\n\");",
486 " // bit presumptiona",
487 " if (_this.file.xtype == \"PlainFile\") {",
489 " // assume it's gtk...",
490 " var oldcode =_this.file.toSource();",
491 " _this.file.setSource(str);",
492 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
493 " \t_this.file.getLanguageServer().document_change(_this.file);",
494 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
495 " _this.file.setSource(oldcode);",
501 " if (_this.file == null) {",
509 " GLib.debug(\"calling validate\"); ",
510 " // clear the buttons.",
511 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
514 "\tvar oldcode = _this.prop.val;",
516 "\t_this.prop.val = str;",
517 "\t_this.node.updated_count++;",
518 " _this.file.getLanguageServer().document_change(_this.file);",
519 " _this.node.updated_count++;",
520 " _this.prop.val = oldcode;",
523 " //print(\"done mark line\\n\");",
525 " return true; // at present allow saving - even if it's invalid..",
529 "| bool highlightErrors" : [
530 "( Gee.HashMap<int,string> validate_res) {",
532 "\tthis.error_line = validate_res.size;",
534 "\tif (this.error_line < 1) {",
537 "\tvar tlines = this.el.get_line_count ();",
538 "\tGtk.TextIter iter;",
539 "\tvar valiter = validate_res.map_iterator();",
540 "\twhile (valiter.next()) {",
542 "\t// print(\"get inter\\n\");",
543 "\t\tvar eline = valiter.get_key();",
544 "\t\tif (eline > tlines) {",
547 "\t\tthis.el.get_iter_at_line( out iter, eline);",
548 "\t\t//print(\"mark line\\n\");",
549 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
554 "| string toString" : [
559 " this.el.get_start_iter(out s);",
560 " this.el.get_end_iter(out e);",
561 " var ret = this.el.get_text(s,e,true);",
562 " //print(\"TO STRING? \" + ret);",
567 "| void showHelp" : [
568 "(Gtk.TextIter iter) {",
569 "\tvar back = iter.copy();",
570 "\tback.backward_char();",
572 "\tvar forward = iter.copy();",
573 "\tforward.forward_char();",
575 "\t// what's the character at the iter?",
576 "\tvar str = back.get_text(iter);",
577 "\tstr += iter.get_text(forward);",
578 "\tif (str.strip().length < 1) {",
581 "\tvar offset = iter.get_line_offset();",
582 "\tvar line = iter.get_line();",
583 "\tif (_this.prop != null) {",
585 "\t\tline += _this.prop.start_line ; ",
586 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
587 "\t\toffset += _this.node.node_pad.length;",
588 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
589 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
590 "\t\t\toffset += 2;",
594 "\tvar ls = _this.file.getLanguageServer();",
596 "\t\t_this.file, line, offset,",
599 "\t\t\t\tvar res = ls.hover.end(o );",
601 "\t\t\t\t_this.helper.setHelp(res);",
602 "\t\t\t} catch (GLib.Error e) {",
612 "# bool is_control" : false,
617 "(keyval, keycode, state) => {",
619 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
620 " \t\tthis.is_control = true;",
627 "(keyval, keycode, state) => {",
629 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
630 " \t\tthis.is_control = false;",
632 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
633 " GLib.debug(\"SAVE: ctrl-S pressed\");",
634 " _this.saveContents();",
638 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
639 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
640 "\t\t_this.forwardSearch(true);",
643 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
644 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
645 "\t\t_this.search_entry.el.grab_focus();",
646 "\t\t_this.search_entry.el.select_region(0,-1);",
649 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
650 "\t\t_this.view.el.show_completion();",
653 "\tGtk.TextIter iter;",
654 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
655 "\tvar line = iter.get_line();",
656 "\tvar offset = iter.get_line_offset();",
657 "\tGLib.debug(\"line %d off %d\", line ,offset);",
658 "\tif (_this.prop != null) {",
659 "\t\tline += _this.prop.start_line + 1; // i think..",
660 "\t\toffset += 12; // should probably be 8 without namespaced ",
661 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
663 " //_this.view.el.show_completion();",
664 " // print(event.key.keyval)",
674 "xtype" : "EventControllerKey"
677 "# double distance" : "0.0f",
679 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
683 "\tif (!_this.keystate.is_control) {",
686 "\t //GLib.debug(\"scroll %f\", dy);",
688 "\tthis.distance += dy;",
690 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
692 "\t if (this.distance < -1) {",
694 "\t\tBuilderApplication.settings.editor_font_size ++;",
695 "\t\tthis.distance = 0;",
697 "\tif (this.distance > 1) {",
698 "\t\tBuilderApplication.settings.editor_font_size --;",
699 "\t\tthis.distance = 0;",
707 "xtype" : "EventControllerScroll"
713 "(n_press, x, y) => {",
714 "\tGtk.TextIter iter;",
715 "\tint buffer_x, buffer_y;",
716 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
718 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
719 "\t\t(int)x - gut.get_width(), (int)y,",
720 " \t\tout buffer_x, out buffer_y);",
721 "\t_this.view.el.get_iter_at_location (out iter, ",
722 "\t\t\tbuffer_x, buffer_y);;",
725 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
726 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
730 "\t_this.buffer.showHelp(iter);",
738 "xtype" : "GestureClick"
743 "(x, y, keyboard_tooltip, tooltip) => {",
745 "\t//GLib.debug(\"query tooltip\");",
746 "\tGtk.TextIter iter;",
749 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
751 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
753 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
754 "\t//\treturn false;",
757 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
759 "\tvar l = iter.get_line();",
763 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
769 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
770 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
771 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
779 "\t// this crashes?? - not sure why.",
780 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
781 "\tif (marks.is_empty()) {",
782 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
784 "\tif (marks.is_empty()) {",
785 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
788 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
790 "\tmarks.@foreach((m) => { ",
791 "\t\t//GLib.debug(\"got mark %s\", m.name);",
792 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
794 "\t// true if there is a mark..",
795 "\tif (str.length > 0 ) {",
796 "\t\ttooltip.set_text( str );",
798 "\treturn str.length > 0 ? true : false;",
804 "string name" : "editor-view",
805 "uint tab_width" : 4,
810 "// show the help page for the active node..",
811 " //this.get('/Help').show();",
813 " // this.get('/BottomPane').el.set_current_page(0);",
814 " \tGLib.debug(\"load called - Reset undo buffer\");",
816 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
817 " buf.begin_irreversible_action();",
818 " buf.set_text(str, str.length);",
819 " buf.end_irreversible_action();",
821 " var lm = GtkSource.LanguageManager.get_default();",
822 " var lang = \"vala\";",
823 " if (_this.file != null) {",
824 " lang = _this.file.language;",
826 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
827 " var lg = _this.file.content_type.length > 0 ?",
828 " lm.guess_language(_this.file.path, _this.file.content_type) :",
829 " lm.get_language(lang);",
832 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
834 " this.el.insert_spaces_instead_of_tabs = true;",
835 " if (lg != null) {",
836 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
837 "\t\tif (lg.name == \"Vala\") {",
838 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
841 " _this.dirty = false;",
842 " this.el.grab_focus();",
843 " _this.save_button.el.sensitive = false;",
844 " _this.last_error_counter = -1;",
849 "xtype" : "ScrolledWindow"
854 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
855 "bool homogeneous" : false,
856 "bool vexpand" : false,
861 "Gtk.CssProvider css" : "",
862 "bool hexpand" : true,
863 "id" : "search_entry",
869 "(keyval, keycode, state) => {",
871 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
872 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
873 "\t\t_this.forwardSearch(true);",
878 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
879 "\t\t_this.forwardSearch(true);",
885 " // print(event.key.keyval)",
892 "xtype" : "EventControllerKey"
899 "_this.search(_this.search_entry.el.text);",
900 "\t _this.search_results.updateResults();",
902 "\tGLib.Timeout.add_seconds(1,() => {",
903 "\t\t _this.search_results.updateResults();",
904 "\t\t return false;",
910 "string name" : "editor-search-entry",
911 "string placeholder_text" : "Press enter to search",
912 "uint search_delay" : 3,
913 "xtype" : "SearchEntry",
914 "| void forwardSearch" : [
915 "(bool change_focus) {",
918 "\t_this.forwardSearch(change_focus);",
922 "\tswitch(_this.windowstate.state) {",
923 "\t\tcase WindowState.State.CODEONLY:",
924 "\t\t//case WindowState.State.CODE:",
925 "\t\t\t// search the code being edited..",
926 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
929 "\t\tcase WindowState.State.PREVIEW:",
930 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
931 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
933 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
946 "id" : "search_results",
947 "int margin_end" : 4,
948 "int margin_start" : 4,
949 "string label" : "No Results",
951 "| void updateResults" : [
953 "\tthis.el.visible = true;",
955 "\tvar res = _this.searchcontext.get_occurrences_count();",
957 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
961 "\t_this.nextBtn.el.sensitive = false;",
962 "\t_this.backBtn.el.sensitive = false;\t",
965 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
966 "\t\t_this.nextBtn.el.sensitive = true;",
967 "\t\t_this.backBtn.el.sensitive = true;",
970 "\t_this.search_results.el.label = \"No Matches\";",
977 "bool always_show_image" : true,
978 "bool sensitive" : false,
984 "\t_this.forwardSearch(true);",
991 "string icon_name" : "go-down",
996 "bool always_show_image" : true,
997 "bool sensitive" : false,
1003 "\t_this.backSearch(true);",
1009 "string icon_name" : "go-up",
1014 "bool always_show_arrow" : true,
1015 "bool always_show_image" : true,
1019 "* prop" : "popover",
1020 "id" : "search_settings",
1025 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1032 "\tthis.el.show();",
1036 "id" : "case_sensitive",
1037 "string label" : "Case Sensitive",
1038 "xtype" : "CheckButton"
1044 "\tthis.el.show();",
1049 "string label" : "Regex",
1050 "xtype" : "CheckButton"
1055 "string label" : "Multi-line (add \\n)",
1056 "xtype" : "CheckButton"
1065 "string icon_name" : "emblem-system",
1066 "xtype" : "MenuButton"
1076 "* prop" : "end_child",
1077 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1078 "bool hexpand" : true,
1079 "bool vexpand" : true,
1080 "bool visible" : false,
1081 "id" : "navigation_holder",
1083 "int width_request" : 120,
1087 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1093 "bool hexpand" : true,
1094 "bool vexpand" : true,
1095 "bool visible" : true,
1096 "id" : "navigationwindow",
1099 "# int last_selected_line" : "-1",
1100 "$ Gtk.Widget? selected_row" : "null",
1103 "id" : "navigation",
1107 "bool expand" : true,
1111 "* prop" : "factory",
1116 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1118 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1119 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1122 "\tvar hbox = (Gtk.Box) expand.child;",
1125 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1126 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1128 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1129 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1131 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1132 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1134 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1136 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1138 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1139 " \texpand.set_list_row(lr);",
1140 " \t//this.in_bind = true;",
1141 " \t// default is to expand",
1143 " \t//this.in_bind = false;",
1145 " \tsym.bind_property(\"symbol_icon\",",
1146 " img, \"icon_name\",",
1147 " GLib.BindingFlags.SYNC_CREATE);",
1149 " \thbox.css_classes = { sym.symbol_icon };",
1151 " \tsym.bind_property(\"name\",",
1153 " GLib.BindingFlags.SYNC_CREATE);",
1154 " \t// should be better?- --line no?",
1155 " \tsym.bind_property(\"tooltip\",",
1156 " lbl, \"tooltip_markup\",",
1157 " GLib.BindingFlags.SYNC_CREATE);",
1158 " \t// bind image...",
1166 "\tvar expand = new Gtk.TreeExpander();",
1168 "\texpand.set_indent_for_depth(true);",
1169 "\texpand.set_indent_for_icon(true);",
1170 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1171 "\tvar icon = new Gtk.Image();",
1172 "\tvar lbl = new Gtk.Label(\"\");",
1173 "\tlbl.use_markup = true;",
1174 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1176 "\ticon.margin_end = 4;",
1177 " \tlbl.justify = Gtk.Justification.LEFT;",
1178 " \tlbl.xalign = 0;",
1180 "//\tlistitem.activatable = true; ??",
1182 "\thbox.append(icon);",
1183 "\thbox.append(lbl);",
1184 "\texpand.set_child(hbox);",
1185 "\t((Gtk.ListItem)listitem).set_child(expand);",
1191 "xtype" : "SignalListItemFactory"
1194 "string title" : "Code Navigation",
1195 "xtype" : "ColumnViewColumn"
1200 "id" : "navigationselmodel",
1205 "id" : "navigationsort",
1208 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1211 "\treturn ((Lsp.DocumentSymbol)item).children;",
1217 "bool autoexpand" : true,
1218 "bool passthrough" : false,
1221 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1224 "id" : "navliststore",
1225 "xtype" : "ListStore",
1226 "| Lsp.DocumentSymbol? symbolAtLine" : [
1227 "(uint line, uint chr) {",
1230 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1231 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1232 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1233 "\t\t//\tel.name , (int)el.range.start.line,",
1234 "\t\t//\t(int)el.range.end.line",
1236 "\t\tvar ret = el.containsLine(line,chr);",
1237 "\t\tif (ret != null) {",
1238 "\t\t\treturn ret;",
1250 "(position, removed, added) => {",
1251 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1252 "\t if (added < 1) { ",
1255 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1256 "\tvar row = this.el.get_row(position);",
1258 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1265 "xtype" : "TreeListModel"
1269 "* prop" : "sorter",
1273 "* prop" : "sorter",
1276 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1278 "* prop" : "expression",
1279 "string property_name" : "sort_key",
1280 "xtype" : "PropertyExpression"
1283 "xtype" : "StringSorter"
1286 "xtype" : "TreeListRowSorter"
1289 "xtype" : "SortListModel",
1290 "| Lsp.DocumentSymbol? getSymbolAt" : [
1293 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1295 " var a = tr.get_item();; ",
1296 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1299 " return (Lsp.DocumentSymbol)tr.get_item();",
1303 "| int getRowFromSymbol" : [
1304 "(Lsp.DocumentSymbol sym) {",
1306 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1307 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1309 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1316 "| void collapseOnLoad" : [
1318 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1319 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1320 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1321 "\t\tswitch (sym.kind) {",
1322 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1323 "\t \t\t\ttr.expanded = false;",
1326 "\t\t\t\t//tr.expanded = true;",
1338 "xtype" : "NoSelection"
1344 "(n_press, x, y) => {",
1346 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1348 " if (row == null) {",
1349 "\t GLib.debug(\"no row selected items\");",
1352 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1353 " //Lsp.DocumentSymbol",
1354 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1355 " if (sym == null) {",
1361 " \"line\" : 1410,",
1362 " \"character\" : 8",
1365 " \"line\" : 1410,",
1366 " \"character\" : 39",
1370 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1371 " _this.scroll_to_line((int)sym.range.start.line);",
1372 " Gtk.TextIter iter;",
1373 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1374 " \t(int)sym.range.start.line,",
1375 " \t(int)sym.range.start.character",
1377 " _this.buffer.el.place_cursor(iter);",
1382 "xtype" : "GestureClick"
1385 "string name" : "editor-navigation",
1386 "xtype" : "ColumnView",
1387 "| Gtk.Widget? getRowWidgetAt" : [
1388 "(double x, double y, out string pos) {",
1391 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1392 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1393 "\tif (w == null) {",
1397 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1398 "\tif (row == null) {",
1402 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1406 "\t//GLib.debug(\"row number is %d\", rn);",
1407 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1408 "\t// above or belw",
1409 "\tGraphene.Rect bounds;",
1410 "\trow.compute_bounds(this.el, out bounds);",
1411 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1412 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1413 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1415 "\tvar ypos = y - bounds.get_y();",
1416 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1417 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1418 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1419 "\tpos = \"over\";",
1421 "\tif (rpos > 80) {",
1422 "\t\tpos = \"below\";",
1423 "\t} else if (rpos < 20) {",
1424 "\t\tpos = \"above\";",
1429 "| int getRowAt" : [
1430 "(double x, double y, out string pos) {",
1433 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1434 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1435 "\tif (w == null) {",
1439 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1440 "\tif (row == null) {",
1444 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1449 "\twhile (cr.get_prev_sibling() != null) {",
1451 "\t\tcr = cr.get_prev_sibling();",
1454 "\t//GLib.debug(\"row number is %d\", rn);",
1455 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1456 "\t// above or belw",
1457 "\tGraphene.Rect bounds;",
1458 "\trow.compute_bounds(this.el, out bounds);",
1459 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1460 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1461 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1463 "\tvar ypos = y - bounds.get_y();",
1464 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1465 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1466 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1467 "\tpos = \"over\";",
1469 "\tif (rpos > 80) {",
1470 "\t\tpos = \"below\";",
1471 "\t} else if (rpos < 20) {",
1472 "\t\tpos = \"above\";",
1478 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1480 "\tif (!_this.navigation_holder.el.visible) {",
1481 "\t\t_this.navigation_holder.el.show();",
1482 "\t\t_this.paned.el.position = ",
1483 "\t\t\t_this.paned.el.get_width() - 200;",
1485 "\t//_this.navliststore.el.remove_all();",
1488 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1490 "\tforeach(var sym in syms) {",
1491 "\t\tls.append(sym);",
1493 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1494 "\t//_this.navliststore.el.append(sym);",
1495 "\tthis.last_selected_line = -1;",
1496 "\tGLib.Idle.add(() => {",
1497 "\t\t_this.navigationsort.collapseOnLoad();",
1498 "\t\tGtk.TextIter iter;",
1499 "\t\t_this.buffer.el.get_iter_at_offset (",
1500 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1502 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1503 "\t\t\t\titer.get_line_offset());",
1504 "\t\tthis.updateSelectedLine(",
1505 "\t\t\t\t(uint)iter.get_line(),",
1506 "\t\t\t\t(uint)iter.get_line_offset()",
1508 "\t\treturn false;",
1513 "| void updateSelectedLine" : [
1514 "(uint line, uint chr) {",
1515 "\tif (line == this.last_selected_line) {",
1518 "\tGLib.debug(\"select line %d\", (int)line);",
1519 "\tthis.last_selected_line = (int)line;",
1522 "\tvar new_row = -1;",
1523 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1524 "\tif (sym != null) {",
1525 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1526 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1528 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1531 "\tif (this.selected_row != null) { ",
1532 "\t\tGLib.debug(\" remove selected row\");",
1533 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1535 "\tthis.selected_row = null;",
1536 "\tif (new_row > -1) {",
1537 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1538 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1539 "\t\tif (row != null) {",
1540 "\t\t\tGLib.debug(\" Add selected row\");",
1542 "\t\t\trow.add_css_class(\"selected-row\");",
1543 "\t\t\tthis.selected_row = row;",
1547 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1557 "xtype" : "ScrolledWindow"
1567 "| bool saveContents" : [
1571 " if (_this.file == null) {",
1577 " var str = _this.buffer.toString();",
1579 " _this.buffer.checkSyntax();",
1583 " // LeftPanel.model.changed( str , false);",
1584 " _this.dirty = false;",
1585 " _this.save_button.el.sensitive = false;",
1587 " // find the text for the node..",
1588 " if (_this.file.xtype != \"PlainFile\") {",
1589 " // in theory these properties have to exist!?!",
1590 " \tthis.prop.val = str;",
1591 " //this.window.windowstate.left_props.reload();",
1593 " _this.file.setSource( str );",
1596 " // call the signal..",
1604 "(string in_txt) {",
1606 "\tvar s = new GtkSource.SearchSettings();",
1607 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1608 "\ts.regex_enabled = _this.regex.el.active;\t",
1609 "\ts.wrap_around = false;",
1611 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1612 "\tthis.searchcontext.set_highlight(true);",
1613 "\tvar txt = in_txt;",
1615 "\tif (_this.multiline.el.active) {",
1616 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1619 "\ts.set_search_text(txt);",
1620 "\tGtk.TextIter beg, st,en;",
1622 "\tthis.buffer.el.get_start_iter(out beg);",
1623 "\tbool has_wrapped_around;",
1624 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1625 "\tthis.last_search_end = 0;",
1627 "\treturn this.searchcontext.get_occurrences_count();",
1635 "| string tempFileContents" : [
1639 " if (_this.file == null) {",
1642 "\tvar str= this.buffer.toString();",
1643 "\tif (_this.file.xtype == \"PlainFile\") {",
1651 " GLib.debug(\"calling validate\"); ",
1652 " // clear the buttons.",
1653 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1654 "\t\treturn this.file.toSource(); ;",
1657 "\tvar oldcode = _this.prop.val;",
1658 "\t_this.prop.val = str;",
1659 " var ret = _this.file.toSource();",
1660 " _this.prop.val = oldcode;",
1665 "| void backSearch" : [
1666 "(bool change_focus) {",
1668 "\tif (this.searchcontext == null) {",
1672 "\tGtk.TextIter beg, st,en;",
1673 "\tbool has_wrapped_around;",
1674 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1676 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1677 "\t\tthis.last_search_end = 0;",
1679 "\t\tthis.last_search_end = en.get_offset();",
1680 "\t\tif (change_focus) {",
1681 "\t\t\tthis.view.el.grab_focus();",
1683 "\t\tthis.buffer.el.place_cursor(st);",
1684 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1690 "| void forwardSearch" : [
1691 "(bool change_focus) {",
1693 "\tif (this.searchcontext == null) {",
1697 "\tGtk.TextIter beg, st,en;",
1698 "\t bool has_wrapped_around;",
1699 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1700 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1702 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1704 "\t\tif (has_wrapped_around) {",
1708 "\t\tthis.last_search_end = en.get_offset();",
1709 "\t\tif (change_focus) {",
1710 "\t\t\tthis.view.el.grab_focus();",
1712 "\t\tthis.buffer.el.place_cursor(st);",
1713 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1721 "\t this.file = null; ",
1723 " this.node = null;",
1724 " this.prop = null;",
1725 "\tthis.searchcontext = null;",
1730 "| void scroll_to_line" : [
1733 "\tGLib.Timeout.add(500, () => {",
1735 "\t\tvar buf = this.view.el.get_buffer();",
1737 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1740 "\t\tGtk.TextIter iter; ",
1741 "\t\tsbuf.get_iter_at_line(out iter, line);",
1742 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1743 "\t\treturn false;",
1749 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1752 " if (this.file != null) {",
1753 " \tthis.file.navigation_tree_updated.disconnect(",
1754 " \t\t_this.navigation.show",
1757 " this.file = file; ",
1758 " this.file.navigation_tree_updated.connect(",
1759 "\t\t_this.navigation.show",
1761 " if (file.xtype != \"PlainFile\") {",
1762 " \tthis.prop = prop;",
1763 " this.node = node;",
1765 " // find the text for the node..",
1766 " this.view.load( prop.val );",
1767 " this.updateErrorMarks();",
1771 " this.close_btn.el.show(); ",
1774 " this.view.load( file.toSource() );",
1775 " this.updateErrorMarks();",
1776 " this.close_btn.el.hide();",
1777 " var ls = file.getLanguageServer();",
1778 " ls.queueDocumentSymbols(file);",
1779 " ////ls.documentSymbols.begin(file, (a,o) => {",
1780 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1782 " //documentSymbols",
1788 "| void updateErrorMarks" : [
1793 "\tvar buf = _this.buffer.el;",
1794 "\tGtk.TextIter start;",
1795 "\tGtk.TextIter end; ",
1796 "\tbuf.get_bounds (out start, out end);",
1801 "\t//GLib.debug(\"highlight errors\");\t\t ",
1803 "\t // we should highlight other types of errors..",
1805 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1807 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1809 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1815 "\tif (_this.file == null) {",
1816 "\t\tGLib.debug(\"file is null?\");",
1820 "\tvar ar = this.file.getErrors();",
1821 "\tif (ar.size < 1) {",
1822 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1823 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1824 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1825 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1826 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1827 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1828 "\t\tthis.last_error_counter = file.error_counter ;",
1829 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1834 " // basicaly check if there is no change, then we do not do any update..",
1835 " // we can do this by just using an error counter?",
1836 " // if that's changed then we will do an update, otherwise dont bother.",
1839 "\tvar offset = 0;",
1840 "\tvar hoffset = 0;",
1842 "\tvar tlines = buf.get_line_count () +1;",
1844 "\tif (_this.prop != null) {",
1845 "\t\t// this still seems flaky...",
1847 "\t\ttlines = _this.prop.end_line;",
1848 "\t\toffset = _this.prop.start_line;",
1849 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1853 "\t\t// no update...",
1854 "\t\tif (this.last_error_counter == file.error_counter) {",
1860 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1861 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1862 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1863 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1864 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1865 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1867 "\tforeach(var diag in ar) { ",
1868 "\t Gtk.TextIter iter;",
1869 "// print(\"get inter\\n\");",
1870 "\t var eline = (int)diag.range.start.line - offset;",
1871 "\t var eline_to = (int)diag.range.end.line - offset;",
1872 "\t //var eline = diag.range.end_line - offset;",
1873 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1874 "\t //\terr.line ,eline, offset);",
1877 "\t if (eline > tlines || eline < 0) {",
1881 "\t buf.get_iter_at_line( out iter, eline);",
1882 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1883 "\t buf.create_source_mark( msg, diag.category, iter);",
1885 " \t var spos = (int)diag.range.start.character - hoffset;",
1886 " \t if (spos < 0) { spos =0 ; }",
1887 " \t if (spos > iter.get_chars_in_line()) {",
1888 " \t \tspos = iter.get_chars_in_line();",
1890 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1891 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1892 " \t if (epos < 0) { epos =0 ; }",
1893 " \t if (epos > iter.get_chars_in_line()) {",
1894 " \t \tepos = iter.get_chars_in_line();",
1898 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1900 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1902 "\t buf.apply_tag_by_name(diag.category, start, end);",
1904 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1905 "\t //this.marks.set(eline, msg);",
1907 "\tthis.last_error_counter = file.error_counter ;",