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 "(Lsp.Hover? help) {",
74 "\tif (help == null || help.contents == null",
75 "\t\t|| help.contents.size < 1) {",
76 "\t\tthis.el.set_text(\"\");",
79 "\tvar sig = help.contents.get(0).value.split(\" \");",
80 "\tstring[] str = {};",
81 "\tfor(var i =0; i < sig.length; i++) {",
83 "\t\tswitch(sig[i]) {",
84 "\t\t\tcase \"public\":",
85 "\t\t\tcase \"private\":",
86 "\t\t\tcase \"protected\":",
87 "\t\t\tcase \"async\":",
88 "\t\t\tcase \"class\":",
94 "\t\t\t\tstr += sig[i];",
100 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
101 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
102 "\t\t\t\t\t+\"</span>\");",
106 "\tif (help.contents.size > 1) {",
107 "\t\tstr += (\"\\n\\n\" + GLib.Markup.escape_text(help.contents.get(1).value));",
110 "\tthis.el.set_markup(string.joinv(\" \",str));",
117 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
120 "\t//this.el.set_range(6,30);",
121 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
122 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
124 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
125 " \t\t//\tGLib.debug(\"update range\");",
126 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
127 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
135 "Gtk.Align halign" : "Gtk.Align.END",
136 "bool draw_value" : false,
137 "bool has_origin" : true,
138 "bool sensitive" : true,
140 "int width_request" : 150,
144 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
147 " \tBuilderApplication.settings.editor_font_size = val;",
156 "Gtk.Align halign" : "Gtk.Align.END",
162 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
163 "string icon_name" : "window-close",
170 " _this.saveContents();",
171 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
176 "string icon_name" : "window-close",
184 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
185 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
186 "bool overlay_scrolling" : false,
187 "bool vexpand" : true,
188 "id" : "RightEditor",
191 "# Gtk.CssProvider css" : "null",
192 "$ gboolean auto_indent" : true,
193 "$ xns" : "GtkSource",
200 "this.el.completion.add_provider(",
201 "\tnew Palete.CompletionProvider(_this)",
204 "// hover seems pretty useless.. - ??",
205 "//var hover = this.el.get_hover();",
206 "//hover.add_provider(new Palete.HoverProvider(_this));",
208 "//this.el.completion.unblock_interactive();",
209 "this.el.completion.select_on_show = true; // select",
210 "//this.el.completion.remember_info_visibility\t = true;",
213 "var attrs = new GtkSource.MarkAttributes();",
215 "attrs.set_icon_name ( \"process-stop\"); ",
216 "attrs.query_tooltip_text.connect(( mark) => {",
217 " GLib.debug(\"tooltip query? %s\", mark.name);",
218 " return strdup( mark.name);",
220 " attrs.query_tooltip_markup.connect(( mark) => {",
221 " GLib.debug(\"tooltip query? %s\", mark.name);",
222 " return strdup( mark.name);",
224 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
228 "var wattrs = new GtkSource.MarkAttributes();",
229 "wattrs.set_icon_name ( \"process-stop\"); ",
230 "wattrs.query_tooltip_text.connect(( mark) => {",
231 " GLib.debug(\"tooltip query? %s\", mark.name);",
232 " return strdup(mark.name);",
234 "wattrs.query_tooltip_markup.connect(( mark) => {",
235 " GLib.debug(\"tooltip query? %s\", mark.name);",
236 " return strdup(mark.name);",
238 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
242 "var dattrs = new GtkSource.MarkAttributes();",
244 "dattrs.set_icon_name ( \"process-stop\"); ",
246 "dattrs.query_tooltip_text.connect(( mark) => {",
247 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
248 " return strdup(mark.name);",
250 "//dattrs.query_tooltip_markup.connect(( mark) => {",
251 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
252 " // return strdup(mark.name);",
254 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
257 " this.el.get_space_drawer().set_matrix(null);",
258 " this.el.get_space_drawer().set_types_for_locations( ",
259 "\tGtkSource.SpaceLocationFlags.ALL,",
260 "\tGtkSource.SpaceTypeFlags.ALL",
262 "this.el.get_space_drawer().set_enable_matrix(true);",
266 "bool has_tooltip" : true,
267 "bool hexpand" : true,
268 "bool insert_spaces_instead_of_tabs" : true,
269 "bool vexpand" : true,
270 "boolean show_line_marks" : true,
271 "boolean show_line_numbers" : true,
272 "css_classes" : "{ \"code-editor\" }",
273 "gboolean highlight_current_line" : true,
278 "$ Gee.HashMap<int,string>? xmarks" : "null",
279 "$ xns" : "GtkSource",
280 "$ xtype" : "Buffer",
283 "var buf = this.el;",
284 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
285 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
286 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
287 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
288 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
289 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
290 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
291 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
294 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
295 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
296 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
302 "bool check_queued" : false,
303 "bool enable_undo" : true,
304 "bool highlight_matching_brackets" : true,
305 "bool highlight_syntax" : true,
307 "int error_line" : "-1",
311 " // check syntax??",
313 " _this.save_button.el.sensitive = true;",
314 " print(\"EDITOR CHANGED\");",
315 " this.checkSyntax();",
317 " _this.dirty = true;",
319 " // this.get('/LeftPanel.model').changed( str , false);",
327 "\tGtk.TextIter iter;",
328 "\tthis.el.get_iter_at_offset (",
329 "\t\t\tout iter, this.el.cursor_position);",
331 "\t_this.navigation.updateSelectedLine(",
332 "\t\t\t(uint)iter.get_line(),",
333 "\t\t\t(uint)iter.get_line_offset()",
335 "\tthis.showHelp(iter);",
341 "| bool OLDhighlightErrorsJson" : [
342 "(string type, Json.Object obj) {",
343 "\tGtk.TextIter start;",
344 "\tGtk.TextIter end; ",
345 "\tthis.el.get_bounds (out start, out end);",
347 "\tthis.el.remove_source_marks (start, end, type);",
348 "\tGLib.debug(\"highlight errors\");\t\t ",
350 "\t // we should highlight other types of errors..",
352 "\tif (!obj.has_member(type)) {",
353 "\t\tGLib.debug(\"Return has no errors\\n\");",
357 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
359 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
361 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
366 "\t//this.marks = new Gee.HashMap<int,string>();",
367 "\tvar err = obj.get_object_member(type);",
369 "\tif (_this.file == null) {",
370 "\t\tGLib.debug(\"file is null?\");",
374 "\tvar valafn = _this.file.path;",
376 "\tif (_this.file.xtype != \"PlainFile\") {",
378 "\t\tvalafn = \"\";",
380 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
381 "\t\t\t// should not happen",
382 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
383 "\t\t} catch (GLib.RegexError e) {",
384 "\t\t\treturn true;",
390 "\tif (!err.has_member(valafn)) {",
391 "\t\tGLib.debug(\"File path has no errors\");",
395 "\tvar lines = err.get_object_member(valafn);",
398 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
399 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
403 "\tvar tlines = this.el.get_line_count () +1;",
405 "\tif (_this.prop != null) {",
407 "\t\ttlines = _this.prop.end_line + 1;",
408 "\t\toffset = _this.prop.start_line + 1;",
414 "\tlines.foreach_member((obj, line, node) => {",
416 "\t Gtk.TextIter iter;",
417 "// print(\"get inter\\n\");",
418 "\t var eline = int.parse(line) - offset;",
419 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
422 "\t if (eline > tlines || eline < 0) {",
427 "\t this.el.get_iter_at_line( out iter, eline);",
428 "\t //print(\"mark line\\n\");",
429 "\t var msg = \"\";",
430 "\t var ar = lines.get_array_member(line);",
431 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
432 "\t \tif (ar.get_string_element(i) == \"Success\") {",
435 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
436 "\t\t\tmsg += ar.get_string_element(i);",
438 "\t\tif (msg == \"\") {",
441 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
442 "\t this.el.create_source_mark(msg, type, iter);",
443 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
444 "\t // this.marks.set(eline, msg);",
455 "| bool checkSyntax" : [
459 " var str = this.toString();",
462 " if (this.error_line > 0) {",
463 " Gtk.TextIter start;",
464 " Gtk.TextIter end; ",
465 " this.el.get_bounds (out start, out end);",
467 " this.el.remove_source_marks (start, end, null);",
469 " if (str.length < 1) {",
470 " print(\"checkSyntax - empty string?\\n\");",
474 " // bit presumptiona",
475 " if (_this.file.xtype == \"PlainFile\") {",
477 " // assume it's gtk...",
478 " var oldcode =_this.file.toSource();",
479 " _this.file.setSource(str);",
480 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
481 " \t_this.file.getLanguageServer().document_change(_this.file);",
482 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
483 " _this.file.setSource(oldcode);",
489 " if (_this.file == null) {",
497 " GLib.debug(\"calling validate\"); ",
498 " // clear the buttons.",
499 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
502 "\tvar oldcode = _this.prop.val;",
504 "\t_this.prop.val = str;",
505 "\t_this.node.updated_count++;",
506 " _this.file.getLanguageServer().document_change(_this.file);",
507 " _this.node.updated_count++;",
508 " _this.prop.val = oldcode;",
511 " //print(\"done mark line\\n\");",
513 " return true; // at present allow saving - even if it's invalid..",
517 "| bool highlightErrors" : [
518 "( Gee.HashMap<int,string> validate_res) {",
520 "\tthis.error_line = validate_res.size;",
522 "\tif (this.error_line < 1) {",
525 "\tvar tlines = this.el.get_line_count ();",
526 "\tGtk.TextIter iter;",
527 "\tvar valiter = validate_res.map_iterator();",
528 "\twhile (valiter.next()) {",
530 "\t// print(\"get inter\\n\");",
531 "\t\tvar eline = valiter.get_key();",
532 "\t\tif (eline > tlines) {",
535 "\t\tthis.el.get_iter_at_line( out iter, eline);",
536 "\t\t//print(\"mark line\\n\");",
537 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
542 "| string toString" : [
547 " this.el.get_start_iter(out s);",
548 " this.el.get_end_iter(out e);",
549 " var ret = this.el.get_text(s,e,true);",
550 " //print(\"TO STRING? \" + ret);",
555 "| void showHelp" : [
556 "(Gtk.TextIter iter) {",
557 "\tvar back = iter.copy();",
558 "\tback.backward_char();",
560 "\tvar forward = iter.copy();",
561 "\tforward.forward_char();",
563 "\t// what's the character at the iter?",
564 "\tvar str = back.get_text(iter);",
565 "\tstr += iter.get_text(forward);",
566 "\tif (str.strip().length < 1) {",
569 "\tvar offset = iter.get_line_offset();",
570 "\tvar line = iter.get_line();",
571 "\tif (_this.prop != null) {",
573 "\t\tline += _this.prop.start_line ; ",
574 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
575 "\t\toffset += _this.node.node_pad.length;",
576 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
577 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
578 "\t\t\toffset += 2;",
582 "\tvar ls = _this.file.getLanguageServer();",
584 "\t\t_this.file, line, offset,",
587 "\t\t\t\tvar res = ls.hover.end(o );",
589 "\t\t\t\t_this.helper.setHelp(res);",
590 "\t\t\t} catch (GLib.Error e) {",
600 "# bool is_control" : false,
605 "(keyval, keycode, state) => {",
607 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
608 " \t\tthis.is_control = true;",
615 "(keyval, keycode, state) => {",
617 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
618 " \t\tthis.is_control = false;",
620 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
621 " GLib.debug(\"SAVE: ctrl-S pressed\");",
622 " _this.saveContents();",
626 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
627 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
628 "\t\t_this.forwardSearch(true);",
631 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
632 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
633 "\t\t_this.search_entry.el.grab_focus();",
634 "\t\t_this.search_entry.el.select_region(0,-1);",
637 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
638 "\t\t_this.view.el.show_completion();",
641 "\tGtk.TextIter iter;",
642 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
643 "\tvar line = iter.get_line();",
644 "\tvar offset = iter.get_line_offset();",
645 "\tGLib.debug(\"line %d off %d\", line ,offset);",
646 "\tif (_this.prop != null) {",
647 "\t\tline += _this.prop.start_line + 1; // i think..",
648 "\t\toffset += 12; // should probably be 8 without namespaced ",
649 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
651 " //_this.view.el.show_completion();",
652 " // print(event.key.keyval)",
662 "xtype" : "EventControllerKey"
665 "# double distance" : "0.0f",
667 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
671 "\tif (!_this.keystate.is_control) {",
674 "\t //GLib.debug(\"scroll %f\", dy);",
676 "\tthis.distance += dy;",
678 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
680 "\t if (this.distance < -1) {",
682 "\t\tBuilderApplication.settings.editor_font_size ++;",
683 "\t\tthis.distance = 0;",
685 "\tif (this.distance > 1) {",
686 "\t\tBuilderApplication.settings.editor_font_size --;",
687 "\t\tthis.distance = 0;",
695 "xtype" : "EventControllerScroll"
701 "(n_press, x, y) => {",
702 "\tGtk.TextIter iter;",
703 "\tint buffer_x, buffer_y;",
704 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
706 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
707 "\t\t(int)x - gut.get_width(), (int)y,",
708 " \t\tout buffer_x, out buffer_y);",
709 "\t_this.view.el.get_iter_at_location (out iter, ",
710 "\t\t\tbuffer_x, buffer_y);;",
713 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
714 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
718 "\t_this.buffer.showHelp(iter);",
726 "xtype" : "GestureClick"
731 "(x, y, keyboard_tooltip, tooltip) => {",
733 "\t//GLib.debug(\"query tooltip\");",
734 "\tGtk.TextIter iter;",
737 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
739 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
741 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
742 "\t//\treturn false;",
745 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
747 "\tvar l = iter.get_line();",
751 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
757 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
758 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
759 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
767 "\t// this crashes?? - not sure why.",
768 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
769 "\tif (marks.is_empty()) {",
770 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
772 "\tif (marks.is_empty()) {",
773 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
776 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
778 "\tmarks.@foreach((m) => { ",
779 "\t\t//GLib.debug(\"got mark %s\", m.name);",
780 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
782 "\t// true if there is a mark..",
783 "\tif (str.length > 0 ) {",
784 "\t\ttooltip.set_text( str );",
786 "\treturn str.length > 0 ? true : false;",
792 "string name" : "editor-view",
793 "uint tab_width" : 4,
798 "// show the help page for the active node..",
799 " //this.get('/Help').show();",
801 " // this.get('/BottomPane').el.set_current_page(0);",
802 " \tGLib.debug(\"load called - Reset undo buffer\");",
804 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
805 " buf.begin_irreversible_action();",
806 " buf.set_text(str, str.length);",
807 " buf.end_irreversible_action();",
809 " var lm = GtkSource.LanguageManager.get_default();",
810 " var lang = \"vala\";",
811 " if (_this.file != null) {",
812 " lang = _this.file.language;",
814 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
815 " var lg = _this.file.content_type.length > 0 ?",
816 " lm.guess_language(_this.file.path, _this.file.content_type) :",
817 " lm.get_language(lang);",
820 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
822 " this.el.insert_spaces_instead_of_tabs = true;",
823 " if (lg != null) {",
824 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
825 "\t\tif (lg.name == \"Vala\") {",
826 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
829 " _this.dirty = false;",
830 " this.el.grab_focus();",
831 " _this.save_button.el.sensitive = false;",
832 " _this.last_error_counter = -1;",
837 "xtype" : "ScrolledWindow"
842 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
843 "bool homogeneous" : false,
844 "bool vexpand" : false,
849 "Gtk.CssProvider css" : "",
850 "bool hexpand" : true,
851 "id" : "search_entry",
857 "(keyval, keycode, state) => {",
859 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
860 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
861 "\t\t_this.forwardSearch(true);",
866 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
867 "\t\t_this.forwardSearch(true);",
873 " // print(event.key.keyval)",
880 "xtype" : "EventControllerKey"
887 "_this.search(_this.search_entry.el.text);",
888 "\t _this.search_results.updateResults();",
890 "\tGLib.Timeout.add_seconds(1,() => {",
891 "\t\t _this.search_results.updateResults();",
892 "\t\t return false;",
898 "string name" : "editor-search-entry",
899 "string placeholder_text" : "Press enter to search",
900 "uint search_delay" : 3,
901 "xtype" : "SearchEntry",
902 "| void forwardSearch" : [
903 "(bool change_focus) {",
906 "\t_this.forwardSearch(change_focus);",
910 "\tswitch(_this.windowstate.state) {",
911 "\t\tcase WindowState.State.CODEONLY:",
912 "\t\t//case WindowState.State.CODE:",
913 "\t\t\t// search the code being edited..",
914 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
917 "\t\tcase WindowState.State.PREVIEW:",
918 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
919 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
921 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
934 "id" : "search_results",
935 "int margin_end" : 4,
936 "int margin_start" : 4,
937 "string label" : "No Results",
939 "| void updateResults" : [
941 "\tthis.el.visible = true;",
943 "\tvar res = _this.searchcontext.get_occurrences_count();",
945 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
949 "\t_this.nextBtn.el.sensitive = false;",
950 "\t_this.backBtn.el.sensitive = false;\t",
953 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
954 "\t\t_this.nextBtn.el.sensitive = true;",
955 "\t\t_this.backBtn.el.sensitive = true;",
958 "\t_this.search_results.el.label = \"No Matches\";",
965 "bool always_show_image" : true,
966 "bool sensitive" : false,
972 "\t_this.forwardSearch(true);",
979 "string icon_name" : "go-down",
984 "bool always_show_image" : true,
985 "bool sensitive" : false,
991 "\t_this.backSearch(true);",
997 "string icon_name" : "go-up",
1002 "bool always_show_arrow" : true,
1003 "bool always_show_image" : true,
1007 "* prop" : "popover",
1008 "id" : "search_settings",
1013 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1020 "\tthis.el.show();",
1024 "id" : "case_sensitive",
1025 "string label" : "Case Sensitive",
1026 "xtype" : "CheckButton"
1032 "\tthis.el.show();",
1037 "string label" : "Regex",
1038 "xtype" : "CheckButton"
1043 "string label" : "Multi-line (add \\n)",
1044 "xtype" : "CheckButton"
1053 "string icon_name" : "emblem-system",
1054 "xtype" : "MenuButton"
1064 "* prop" : "end_child",
1065 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1066 "bool hexpand" : true,
1067 "bool vexpand" : true,
1068 "bool visible" : false,
1069 "id" : "navigation_holder",
1071 "int width_request" : 120,
1075 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1081 "bool hexpand" : true,
1082 "bool vexpand" : true,
1083 "bool visible" : true,
1084 "id" : "navigationwindow",
1087 "# int last_selected_line" : "-1",
1088 "$ Gtk.Widget? selected_row" : "null",
1091 "id" : "navigation",
1095 "bool expand" : true,
1099 "* prop" : "factory",
1104 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1106 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1107 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1110 "\tvar hbox = (Gtk.Box) expand.child;",
1113 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1114 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1116 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1117 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1119 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1120 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1122 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1124 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1126 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1127 " \texpand.set_list_row(lr);",
1128 " \t//this.in_bind = true;",
1129 " \t// default is to expand",
1131 " \t//this.in_bind = false;",
1133 " \tsym.bind_property(\"symbol_icon\",",
1134 " img, \"icon_name\",",
1135 " GLib.BindingFlags.SYNC_CREATE);",
1137 " \thbox.css_classes = { sym.symbol_icon };",
1139 " \tsym.bind_property(\"name\",",
1141 " GLib.BindingFlags.SYNC_CREATE);",
1142 " \t// should be better?- --line no?",
1143 " \tsym.bind_property(\"tooltip\",",
1144 " lbl, \"tooltip_markup\",",
1145 " GLib.BindingFlags.SYNC_CREATE);",
1146 " \t// bind image...",
1154 "\tvar expand = new Gtk.TreeExpander();",
1156 "\texpand.set_indent_for_depth(true);",
1157 "\texpand.set_indent_for_icon(true);",
1158 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1159 "\tvar icon = new Gtk.Image();",
1160 "\tvar lbl = new Gtk.Label(\"\");",
1161 "\tlbl.use_markup = true;",
1162 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1164 "\ticon.margin_end = 4;",
1165 " \tlbl.justify = Gtk.Justification.LEFT;",
1166 " \tlbl.xalign = 0;",
1168 "//\tlistitem.activatable = true; ??",
1170 "\thbox.append(icon);",
1171 "\thbox.append(lbl);",
1172 "\texpand.set_child(hbox);",
1173 "\t((Gtk.ListItem)listitem).set_child(expand);",
1179 "xtype" : "SignalListItemFactory"
1182 "string title" : "Code Navigation",
1183 "xtype" : "ColumnViewColumn"
1188 "id" : "navigationselmodel",
1193 "id" : "navigationsort",
1196 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1199 "\treturn ((Lsp.DocumentSymbol)item).children;",
1205 "bool autoexpand" : true,
1206 "bool passthrough" : false,
1209 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1212 "id" : "navliststore",
1213 "xtype" : "ListStore",
1214 "| Lsp.DocumentSymbol? symbolAtLine" : [
1215 "(uint line, uint chr) {",
1218 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1219 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1220 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1221 "\t\t//\tel.name , (int)el.range.start.line,",
1222 "\t\t//\t(int)el.range.end.line",
1224 "\t\tvar ret = el.containsLine(line,chr);",
1225 "\t\tif (ret != null) {",
1226 "\t\t\treturn ret;",
1238 "(position, removed, added) => {",
1239 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1240 "\t if (added < 1) { ",
1243 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1244 "\tvar row = this.el.get_row(position);",
1246 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1253 "xtype" : "TreeListModel"
1257 "* prop" : "sorter",
1261 "* prop" : "sorter",
1264 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1266 "* prop" : "expression",
1267 "string property_name" : "sort_key",
1268 "xtype" : "PropertyExpression"
1271 "xtype" : "StringSorter"
1274 "xtype" : "TreeListRowSorter"
1277 "xtype" : "SortListModel",
1278 "| Lsp.DocumentSymbol? getSymbolAt" : [
1281 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1283 " var a = tr.get_item();; ",
1284 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1287 " return (Lsp.DocumentSymbol)tr.get_item();",
1291 "| int getRowFromSymbol" : [
1292 "(Lsp.DocumentSymbol sym) {",
1294 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1295 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1297 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1304 "| void collapseOnLoad" : [
1306 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1307 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1308 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1309 "\t\tswitch (sym.kind) {",
1310 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1311 "\t \t\t\ttr.expanded = false;",
1314 "\t\t\t\t//tr.expanded = true;",
1326 "xtype" : "NoSelection"
1332 "(n_press, x, y) => {",
1334 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1336 " if (row == null) {",
1337 "\t GLib.debug(\"no row selected items\");",
1340 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1341 " //Lsp.DocumentSymbol",
1342 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1343 " if (sym == null) {",
1349 " \"line\" : 1410,",
1350 " \"character\" : 8",
1353 " \"line\" : 1410,",
1354 " \"character\" : 39",
1358 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1359 " _this.scroll_to_line((int)sym.range.start.line);",
1360 " Gtk.TextIter iter;",
1361 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1362 " \t(int)sym.range.start.line,",
1363 " \t(int)sym.range.start.character",
1365 " _this.buffer.el.place_cursor(iter);",
1370 "xtype" : "GestureClick"
1373 "string name" : "editor-navigation",
1374 "xtype" : "ColumnView",
1375 "| Gtk.Widget? getRowWidgetAt" : [
1376 "(double x, double y, out string pos) {",
1379 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1380 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1381 "\tif (w == null) {",
1385 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1386 "\tif (row == null) {",
1390 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1394 "\t//GLib.debug(\"row number is %d\", rn);",
1395 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1396 "\t// above or belw",
1397 "\tGraphene.Rect bounds;",
1398 "\trow.compute_bounds(this.el, out bounds);",
1399 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1400 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1401 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1403 "\tvar ypos = y - bounds.get_y();",
1404 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1405 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1406 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1407 "\tpos = \"over\";",
1409 "\tif (rpos > 80) {",
1410 "\t\tpos = \"below\";",
1411 "\t} else if (rpos < 20) {",
1412 "\t\tpos = \"above\";",
1417 "| int getRowAt" : [
1418 "(double x, double y, out string pos) {",
1421 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1422 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1423 "\tif (w == null) {",
1427 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1428 "\tif (row == null) {",
1432 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1437 "\twhile (cr.get_prev_sibling() != null) {",
1439 "\t\tcr = cr.get_prev_sibling();",
1442 "\t//GLib.debug(\"row number is %d\", rn);",
1443 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1444 "\t// above or belw",
1445 "\tGraphene.Rect bounds;",
1446 "\trow.compute_bounds(this.el, out bounds);",
1447 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1448 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1449 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1451 "\tvar ypos = y - bounds.get_y();",
1452 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1453 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1454 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1455 "\tpos = \"over\";",
1457 "\tif (rpos > 80) {",
1458 "\t\tpos = \"below\";",
1459 "\t} else if (rpos < 20) {",
1460 "\t\tpos = \"above\";",
1466 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1468 "\tif (!_this.navigation_holder.el.visible) {",
1469 "\t\t_this.navigation_holder.el.show();",
1470 "\t\t_this.paned.el.position = ",
1471 "\t\t\t_this.paned.el.get_width() - 200;",
1473 "\t//_this.navliststore.el.remove_all();",
1476 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1478 "\tforeach(var sym in syms) {",
1479 "\t\tls.append(sym);",
1481 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1482 "\t//_this.navliststore.el.append(sym);",
1483 "\tthis.last_selected_line = -1;",
1484 "\tGLib.Idle.add(() => {",
1485 "\t\t_this.navigationsort.collapseOnLoad();",
1486 "\t\tGtk.TextIter iter;",
1487 "\t\t_this.buffer.el.get_iter_at_offset (",
1488 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1490 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1491 "\t\t\t\titer.get_line_offset());",
1492 "\t\tthis.updateSelectedLine(",
1493 "\t\t\t\t(uint)iter.get_line(),",
1494 "\t\t\t\t(uint)iter.get_line_offset()",
1496 "\t\treturn false;",
1501 "| void updateSelectedLine" : [
1502 "(uint line, uint chr) {",
1503 "\tif (line == this.last_selected_line) {",
1506 "\tGLib.debug(\"select line %d\", (int)line);",
1507 "\tthis.last_selected_line = (int)line;",
1510 "\tvar new_row = -1;",
1511 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1512 "\tif (sym != null) {",
1513 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1514 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1516 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1519 "\tif (this.selected_row != null) { ",
1520 "\t\tGLib.debug(\" remove selected row\");",
1521 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1523 "\tthis.selected_row = null;",
1524 "\tif (new_row > -1) {",
1525 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1526 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1527 "\t\tif (row != null) {",
1528 "\t\t\tGLib.debug(\" Add selected row\");",
1530 "\t\t\trow.add_css_class(\"selected-row\");",
1531 "\t\t\tthis.selected_row = row;",
1535 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1545 "xtype" : "ScrolledWindow"
1555 "| bool saveContents" : [
1559 " if (_this.file == null) {",
1565 " var str = _this.buffer.toString();",
1567 " _this.buffer.checkSyntax();",
1571 " // LeftPanel.model.changed( str , false);",
1572 " _this.dirty = false;",
1573 " _this.save_button.el.sensitive = false;",
1575 " // find the text for the node..",
1576 " if (_this.file.xtype != \"PlainFile\") {",
1577 " // in theory these properties have to exist!?!",
1578 " \tthis.prop.val = str;",
1579 " //this.window.windowstate.left_props.reload();",
1581 " _this.file.setSource( str );",
1584 " // call the signal..",
1592 "(string in_txt) {",
1594 "\tvar s = new GtkSource.SearchSettings();",
1595 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1596 "\ts.regex_enabled = _this.regex.el.active;\t",
1597 "\ts.wrap_around = false;",
1599 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1600 "\tthis.searchcontext.set_highlight(true);",
1601 "\tvar txt = in_txt;",
1603 "\tif (_this.multiline.el.active) {",
1604 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1607 "\ts.set_search_text(txt);",
1608 "\tGtk.TextIter beg, st,en;",
1610 "\tthis.buffer.el.get_start_iter(out beg);",
1611 "\tbool has_wrapped_around;",
1612 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1613 "\tthis.last_search_end = 0;",
1615 "\treturn this.searchcontext.get_occurrences_count();",
1623 "| string tempFileContents" : [
1627 " if (_this.file == null) {",
1630 "\tvar str= this.buffer.toString();",
1631 "\tif (_this.file.xtype == \"PlainFile\") {",
1639 " GLib.debug(\"calling validate\"); ",
1640 " // clear the buttons.",
1641 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1642 "\t\treturn this.file.toSource(); ;",
1645 "\tvar oldcode = _this.prop.val;",
1646 "\t_this.prop.val = str;",
1647 " var ret = _this.file.toSource();",
1648 " _this.prop.val = oldcode;",
1653 "| void backSearch" : [
1654 "(bool change_focus) {",
1656 "\tif (this.searchcontext == null) {",
1660 "\tGtk.TextIter beg, st,en;",
1661 "\tbool has_wrapped_around;",
1662 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1664 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1665 "\t\tthis.last_search_end = 0;",
1667 "\t\tthis.last_search_end = en.get_offset();",
1668 "\t\tif (change_focus) {",
1669 "\t\t\tthis.view.el.grab_focus();",
1671 "\t\tthis.buffer.el.place_cursor(st);",
1672 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1678 "| void forwardSearch" : [
1679 "(bool change_focus) {",
1681 "\tif (this.searchcontext == null) {",
1685 "\tGtk.TextIter beg, st,en;",
1686 "\t bool has_wrapped_around;",
1687 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1688 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1690 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1692 "\t\tif (has_wrapped_around) {",
1696 "\t\tthis.last_search_end = en.get_offset();",
1697 "\t\tif (change_focus) {",
1698 "\t\t\tthis.view.el.grab_focus();",
1700 "\t\tthis.buffer.el.place_cursor(st);",
1701 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1709 "\t this.file = null; ",
1711 " this.node = null;",
1712 " this.prop = null;",
1713 "\tthis.searchcontext = null;",
1718 "| void scroll_to_line" : [
1721 "\tGLib.Timeout.add(500, () => {",
1723 "\t\tvar buf = this.view.el.get_buffer();",
1725 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1728 "\t\tGtk.TextIter iter; ",
1729 "\t\tsbuf.get_iter_at_line(out iter, line);",
1730 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1731 "\t\treturn false;",
1737 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1740 " if (this.file != null) {",
1741 " \tthis.file.navigation_tree_updated.disconnect(",
1742 " \t\t_this.navigation.show",
1745 " this.file = file; ",
1746 " this.file.navigation_tree_updated.connect(",
1747 "\t\t_this.navigation.show",
1749 " if (file.xtype != \"PlainFile\") {",
1750 " \tthis.prop = prop;",
1751 " this.node = node;",
1753 " // find the text for the node..",
1754 " this.view.load( prop.val );",
1755 " this.updateErrorMarks();",
1759 " this.close_btn.el.show(); ",
1762 " this.view.load( file.toSource() );",
1763 " this.updateErrorMarks();",
1764 " this.close_btn.el.hide();",
1765 " var ls = file.getLanguageServer();",
1766 " ls.queueDocumentSymbols(file);",
1767 " ////ls.documentSymbols.begin(file, (a,o) => {",
1768 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1770 " //documentSymbols",
1776 "| void updateErrorMarks" : [
1781 "\tvar buf = _this.buffer.el;",
1782 "\tGtk.TextIter start;",
1783 "\tGtk.TextIter end; ",
1784 "\tbuf.get_bounds (out start, out end);",
1789 "\t//GLib.debug(\"highlight errors\");\t\t ",
1791 "\t // we should highlight other types of errors..",
1793 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1795 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1797 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1803 "\tif (_this.file == null) {",
1804 "\t\tGLib.debug(\"file is null?\");",
1808 "\tvar ar = this.file.getErrors();",
1809 "\tif (ar.size < 1) {",
1810 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1811 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1812 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1813 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1814 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1815 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1816 "\t\tthis.last_error_counter = file.error_counter ;",
1817 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1822 " // basicaly check if there is no change, then we do not do any update..",
1823 " // we can do this by just using an error counter?",
1824 " // if that's changed then we will do an update, otherwise dont bother.",
1827 "\tvar offset = 0;",
1828 "\tvar hoffset = 0;",
1830 "\tvar tlines = buf.get_line_count () +1;",
1832 "\tif (_this.prop != null) {",
1833 "\t\t// this still seems flaky...",
1835 "\t\ttlines = _this.prop.end_line;",
1836 "\t\toffset = _this.prop.start_line;",
1837 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1841 "\t\t// no update...",
1842 "\t\tif (this.last_error_counter == file.error_counter) {",
1848 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1849 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1850 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1851 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1852 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1853 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1855 "\tforeach(var diag in ar) { ",
1856 "\t Gtk.TextIter iter;",
1857 "// print(\"get inter\\n\");",
1858 "\t var eline = (int)diag.range.start.line - offset;",
1859 "\t var eline_to = (int)diag.range.end.line - offset;",
1860 "\t //var eline = diag.range.end_line - offset;",
1861 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1862 "\t //\terr.line ,eline, offset);",
1865 "\t if (eline > tlines || eline < 0) {",
1869 "\t buf.get_iter_at_line( out iter, eline);",
1870 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1871 "\t buf.create_source_mark( msg, diag.category, iter);",
1873 " \t var spos = (int)diag.range.start.character - hoffset;",
1874 " \t if (spos < 0) { spos =0 ; }",
1875 " \t if (spos > iter.get_chars_in_line()) {",
1876 " \t \tspos = iter.get_chars_in_line();",
1878 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1879 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1880 " \t if (epos < 0) { epos =0 ; }",
1881 " \t if (epos > iter.get_chars_in_line()) {",
1882 " \t \tepos = iter.get_chars_in_line();",
1886 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1888 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1890 "\t buf.apply_tag_by_name(diag.category, start, end);",
1892 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1893 "\t //this.marks.set(eline, msg);",
1895 "\tthis.last_error_counter = file.error_counter ;",