2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# GtkSource.SearchContext searchcontext" : "null",
7 "# JsRender.JsRender? file" : "null",
8 "# JsRender.Node node" : "null",
9 "# JsRender.NodeProp? prop" : "null",
10 "# Xcls_MainWindow window" : "null",
11 "# bool dirty" : false,
13 "# int last_error_counter" : 0,
14 "# int pos_root_x" : "",
15 "# int pos_root_y" : "",
16 "# string activeEditor" : "\"\"",
17 "$ homogeneous" : false,
20 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21 "bool hexpand" : true,
22 "bool vexpand" : true,
23 "int last_search_end" : 0,
27 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
28 "bool resize_end_child" : false,
29 "bool resize_start_child" : false,
30 "bool shrink_end_child" : false,
31 "bool shrink_start_child" : false,
36 "* prop" : "start_child",
37 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
38 "bool hexpand" : true,
42 "$ homogeneous" : false,
44 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
45 "bool hexpand" : false,
46 "bool vexpand" : false,
50 "bool vexpand" : true,
56 " _this.saveContents();",
65 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
66 "bool hexpand" : true,
70 "int margin_start" : 4,
73 "(x, y, keyboard_tooltip, tooltip) => {",
74 "\tGLib.debug(\"using quiery tooltip?\");",
75 "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);",
76 "\tlbl.width_request = 500;",
77 "\ttooltip.set_custom(lbl);",
86 "(Lsp.Hover? help) {",
87 "\tif (help == null || help.contents == null",
88 "\t\t|| help.contents.size < 1) {",
89 "\t\tthis.el.set_text(\"\");",
92 "\tvar sig = help.contents.get(0).value.split(\" \");",
93 "\tstring[] str = {};",
94 "\tfor(var i =0; i < sig.length; i++) {",
96 "\t\tswitch(sig[i]) {",
97 "\t\t\tcase \"public\":",
98 "\t\t\tcase \"private\":",
99 "\t\t\tcase \"protected\":",
100 "\t\t\tcase \"async\":",
101 "\t\t\tcase \"class\":",
107 "\t\t\t\tstr += sig[i];",
113 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
114 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
115 "\t\t\t\t\t+\"</span>\");",
119 "\tif (help.contents.size > 1) {",
120 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
123 "\tthis.el.set_markup(string.joinv(\" \",str));",
130 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
133 "\t//this.el.set_range(6,30);",
134 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
135 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
137 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
138 " \t\t//\tGLib.debug(\"update range\");",
139 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
140 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
148 "Gtk.Align halign" : "Gtk.Align.END",
149 "bool draw_value" : false,
150 "bool has_origin" : true,
151 "bool sensitive" : true,
153 "int width_request" : 150,
157 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
160 " \tBuilderApplication.settings.editor_font_size = val;",
169 "Gtk.Align halign" : "Gtk.Align.END",
175 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
176 "string icon_name" : "window-close",
183 " _this.saveContents();",
184 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
189 "string icon_name" : "window-close",
197 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
198 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
199 "bool overlay_scrolling" : false,
200 "bool vexpand" : true,
201 "id" : "RightEditor",
204 "# Gtk.CssProvider css" : "null",
205 "$ gboolean auto_indent" : true,
206 "$ xns" : "GtkSource",
213 "this.el.completion.add_provider(",
214 "\tnew Palete.CompletionProvider(_this)",
217 "// hover seems pretty useless.. - ??",
218 "//var hover = this.el.get_hover();",
219 "//hover.add_provider(new Palete.HoverProvider(_this));",
221 "//this.el.completion.unblock_interactive();",
222 "this.el.completion.select_on_show = true; // select",
223 "//this.el.completion.remember_info_visibility\t = true;",
226 "var attrs = new GtkSource.MarkAttributes();",
228 "attrs.set_icon_name ( \"process-stop\"); ",
229 "attrs.query_tooltip_text.connect(( mark) => {",
230 " GLib.debug(\"tooltip query? %s\", mark.name);",
231 " return strdup( mark.name);",
233 " attrs.query_tooltip_markup.connect(( mark) => {",
234 " GLib.debug(\"tooltip query? %s\", mark.name);",
235 " return strdup( mark.name);",
237 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
241 "var wattrs = new GtkSource.MarkAttributes();",
242 "wattrs.set_icon_name ( \"process-stop\"); ",
243 "wattrs.query_tooltip_text.connect(( mark) => {",
244 " GLib.debug(\"tooltip query? %s\", mark.name);",
245 " return strdup(mark.name);",
247 "wattrs.query_tooltip_markup.connect(( mark) => {",
248 " GLib.debug(\"tooltip query? %s\", mark.name);",
249 " return strdup(mark.name);",
251 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
255 "var dattrs = new GtkSource.MarkAttributes();",
257 "dattrs.set_icon_name ( \"process-stop\"); ",
259 "dattrs.query_tooltip_text.connect(( mark) => {",
260 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
261 " return strdup(mark.name);",
263 "//dattrs.query_tooltip_markup.connect(( mark) => {",
264 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
265 " // return strdup(mark.name);",
267 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
270 " this.el.get_space_drawer().set_matrix(null);",
271 " this.el.get_space_drawer().set_types_for_locations( ",
272 "\tGtkSource.SpaceLocationFlags.ALL,",
273 "\tGtkSource.SpaceTypeFlags.ALL",
275 "this.el.get_space_drawer().set_enable_matrix(true);",
279 "bool has_tooltip" : true,
280 "bool hexpand" : true,
281 "bool insert_spaces_instead_of_tabs" : true,
282 "bool vexpand" : true,
283 "boolean show_line_marks" : true,
284 "boolean show_line_numbers" : true,
285 "css_classes" : "{ \"code-editor\" }",
286 "gboolean highlight_current_line" : true,
291 "$ Gee.HashMap<int,string>? xmarks" : "null",
292 "$ xns" : "GtkSource",
293 "$ xtype" : "Buffer",
296 "var buf = this.el;",
297 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
298 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
299 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
300 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
301 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
302 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
303 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
304 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
307 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
308 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
309 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
315 "bool check_queued" : false,
316 "bool enable_undo" : true,
317 "bool highlight_matching_brackets" : true,
318 "bool highlight_syntax" : true,
320 "int error_line" : "-1",
324 " // check syntax??",
326 " _this.save_button.el.sensitive = true;",
327 " print(\"EDITOR CHANGED\");",
328 " this.checkSyntax();",
330 " _this.dirty = true;",
332 " // this.get('/LeftPanel.model').changed( str , false);",
340 "\tGtk.TextIter iter;",
341 "\tthis.el.get_iter_at_offset (",
342 "\t\t\tout iter, this.el.cursor_position);",
344 "\t_this.navigation.updateSelectedLine(",
345 "\t\t\t(uint)iter.get_line(),",
346 "\t\t\t(uint)iter.get_line_offset()",
348 "\tthis.showHelp(iter);",
354 "| bool OLDhighlightErrorsJson" : [
355 "(string type, Json.Object obj) {",
356 "\tGtk.TextIter start;",
357 "\tGtk.TextIter end; ",
358 "\tthis.el.get_bounds (out start, out end);",
360 "\tthis.el.remove_source_marks (start, end, type);",
361 "\tGLib.debug(\"highlight errors\");\t\t ",
363 "\t // we should highlight other types of errors..",
365 "\tif (!obj.has_member(type)) {",
366 "\t\tGLib.debug(\"Return has no errors\\n\");",
370 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
372 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
374 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
379 "\t//this.marks = new Gee.HashMap<int,string>();",
380 "\tvar err = obj.get_object_member(type);",
382 "\tif (_this.file == null) {",
383 "\t\tGLib.debug(\"file is null?\");",
387 "\tvar valafn = _this.file.path;",
389 "\tif (_this.file.xtype != \"PlainFile\") {",
391 "\t\tvalafn = \"\";",
393 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
394 "\t\t\t// should not happen",
395 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
396 "\t\t} catch (GLib.RegexError e) {",
397 "\t\t\treturn true;",
403 "\tif (!err.has_member(valafn)) {",
404 "\t\tGLib.debug(\"File path has no errors\");",
408 "\tvar lines = err.get_object_member(valafn);",
411 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
412 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
416 "\tvar tlines = this.el.get_line_count () +1;",
418 "\tif (_this.prop != null) {",
420 "\t\ttlines = _this.prop.end_line + 1;",
421 "\t\toffset = _this.prop.start_line + 1;",
427 "\tlines.foreach_member((obj, line, node) => {",
429 "\t Gtk.TextIter iter;",
430 "// print(\"get inter\\n\");",
431 "\t var eline = int.parse(line) - offset;",
432 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
435 "\t if (eline > tlines || eline < 0) {",
440 "\t this.el.get_iter_at_line( out iter, eline);",
441 "\t //print(\"mark line\\n\");",
442 "\t var msg = \"\";",
443 "\t var ar = lines.get_array_member(line);",
444 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
445 "\t \tif (ar.get_string_element(i) == \"Success\") {",
448 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
449 "\t\t\tmsg += ar.get_string_element(i);",
451 "\t\tif (msg == \"\") {",
454 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
455 "\t this.el.create_source_mark(msg, type, iter);",
456 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
457 "\t // this.marks.set(eline, msg);",
468 "| bool checkSyntax" : [
472 " var str = this.toString();",
475 " if (this.error_line > 0) {",
476 " Gtk.TextIter start;",
477 " Gtk.TextIter end; ",
478 " this.el.get_bounds (out start, out end);",
480 " this.el.remove_source_marks (start, end, null);",
482 " if (str.length < 1) {",
483 " print(\"checkSyntax - empty string?\\n\");",
487 " // bit presumptiona",
488 " if (_this.file.xtype == \"PlainFile\") {",
490 " // assume it's gtk...",
491 " var oldcode =_this.file.toSource();",
492 " _this.file.setSource(str);",
493 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
494 " \t_this.file.getLanguageServer().document_change(_this.file);",
495 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
496 " _this.file.setSource(oldcode);",
502 " if (_this.file == null) {",
510 " GLib.debug(\"calling validate\"); ",
511 " // clear the buttons.",
512 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
515 "\tvar oldcode = _this.prop.val;",
517 "\t_this.prop.val = str;",
518 "\t_this.node.updated_count++;",
519 " _this.file.getLanguageServer().document_change(_this.file);",
520 " _this.node.updated_count++;",
521 " _this.prop.val = oldcode;",
524 " //print(\"done mark line\\n\");",
526 " return true; // at present allow saving - even if it's invalid..",
530 "| bool highlightErrors" : [
531 "( Gee.HashMap<int,string> validate_res) {",
533 "\tthis.error_line = validate_res.size;",
535 "\tif (this.error_line < 1) {",
538 "\tvar tlines = this.el.get_line_count ();",
539 "\tGtk.TextIter iter;",
540 "\tvar valiter = validate_res.map_iterator();",
541 "\twhile (valiter.next()) {",
543 "\t// print(\"get inter\\n\");",
544 "\t\tvar eline = valiter.get_key();",
545 "\t\tif (eline > tlines) {",
548 "\t\tthis.el.get_iter_at_line( out iter, eline);",
549 "\t\t//print(\"mark line\\n\");",
550 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
555 "| string toString" : [
560 " this.el.get_start_iter(out s);",
561 " this.el.get_end_iter(out e);",
562 " var ret = this.el.get_text(s,e,true);",
563 " //print(\"TO STRING? \" + ret);",
568 "| void showHelp" : [
569 "(Gtk.TextIter iter) {",
570 "\tvar back = iter.copy();",
571 "\tback.backward_char();",
573 "\tvar forward = iter.copy();",
574 "\tforward.forward_char();",
576 "\t// what's the character at the iter?",
577 "\tvar str = back.get_text(iter);",
578 "\tstr += iter.get_text(forward);",
579 "\tif (str.strip().length < 1) {",
582 "\tvar offset = iter.get_line_offset();",
583 "\tvar line = iter.get_line();",
584 "\tif (_this.prop != null) {",
586 "\t\tline += _this.prop.start_line ; ",
587 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
588 "\t\toffset += _this.node.node_pad.length;",
589 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
590 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
591 "\t\t\toffset += 2;",
595 "\tvar ls = _this.file.getLanguageServer();",
597 "\t\t_this.file, line, offset,",
600 "\t\t\t\tvar res = ls.hover.end(o );",
602 "\t\t\t\t_this.helper.setHelp(res);",
603 "\t\t\t} catch (GLib.Error e) {",
613 "# bool is_control" : false,
618 "(keyval, keycode, state) => {",
620 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
621 " \t\tthis.is_control = true;",
628 "(keyval, keycode, state) => {",
630 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
631 " \t\tthis.is_control = false;",
633 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
634 " GLib.debug(\"SAVE: ctrl-S pressed\");",
635 " _this.saveContents();",
639 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
640 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
641 "\t\t_this.forwardSearch(true);",
644 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
645 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
646 "\t\t_this.search_entry.el.grab_focus();",
647 "\t\t_this.search_entry.el.select_region(0,-1);",
650 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
651 "\t\t_this.view.el.show_completion();",
654 "\tGtk.TextIter iter;",
655 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
656 "\tvar line = iter.get_line();",
657 "\tvar offset = iter.get_line_offset();",
658 "\tGLib.debug(\"line %d off %d\", line ,offset);",
659 "\tif (_this.prop != null) {",
660 "\t\tline += _this.prop.start_line + 1; // i think..",
661 "\t\toffset += 12; // should probably be 8 without namespaced ",
662 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
664 " //_this.view.el.show_completion();",
665 " // print(event.key.keyval)",
675 "xtype" : "EventControllerKey"
678 "# double distance" : "0.0f",
680 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
684 "\tif (!_this.keystate.is_control) {",
687 "\t //GLib.debug(\"scroll %f\", dy);",
689 "\tthis.distance += dy;",
691 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
693 "\t if (this.distance < -1) {",
695 "\t\tBuilderApplication.settings.editor_font_size ++;",
696 "\t\tthis.distance = 0;",
698 "\tif (this.distance > 1) {",
699 "\t\tBuilderApplication.settings.editor_font_size --;",
700 "\t\tthis.distance = 0;",
708 "xtype" : "EventControllerScroll"
714 "(n_press, x, y) => {",
715 "\tGtk.TextIter iter;",
716 "\tint buffer_x, buffer_y;",
717 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
719 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
720 "\t\t(int)x - gut.get_width(), (int)y,",
721 " \t\tout buffer_x, out buffer_y);",
722 "\t_this.view.el.get_iter_at_location (out iter, ",
723 "\t\t\tbuffer_x, buffer_y);;",
726 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
727 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
731 "\t_this.buffer.showHelp(iter);",
739 "xtype" : "GestureClick"
744 "(x, y, keyboard_tooltip, tooltip) => {",
746 "\t//GLib.debug(\"query tooltip\");",
747 "\tGtk.TextIter iter;",
750 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
752 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
754 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
755 "\t//\treturn false;",
758 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
760 "\tvar l = iter.get_line();",
764 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
770 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
771 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
772 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
780 "\t// this crashes?? - not sure why.",
781 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
782 "\tif (marks.is_empty()) {",
783 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
785 "\tif (marks.is_empty()) {",
786 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
789 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
791 "\tmarks.@foreach((m) => { ",
792 "\t\t//GLib.debug(\"got mark %s\", m.name);",
793 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
795 "\t// true if there is a mark..",
796 "\tif (str.length > 0 ) {",
797 "\t\ttooltip.set_text( str );",
799 "\treturn str.length > 0 ? true : false;",
805 "string name" : "editor-view",
806 "uint tab_width" : 4,
811 "// show the help page for the active node..",
812 " //this.get('/Help').show();",
814 " // this.get('/BottomPane').el.set_current_page(0);",
815 " \tGLib.debug(\"load called - Reset undo buffer\");",
817 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
818 " buf.begin_irreversible_action();",
819 " buf.set_text(str, str.length);",
820 " buf.end_irreversible_action();",
822 " var lm = GtkSource.LanguageManager.get_default();",
823 " var lang = \"vala\";",
824 " if (_this.file != null) {",
825 " lang = _this.file.language;",
827 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
828 " var lg = _this.file.content_type.length > 0 ?",
829 " lm.guess_language(_this.file.path, _this.file.content_type) :",
830 " lm.get_language(lang);",
833 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
835 " this.el.insert_spaces_instead_of_tabs = true;",
836 " if (lg != null) {",
837 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
838 "\t\tif (lg.name == \"Vala\") {",
839 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
842 " _this.dirty = false;",
843 " this.el.grab_focus();",
844 " _this.save_button.el.sensitive = false;",
845 " _this.last_error_counter = -1;",
850 "xtype" : "ScrolledWindow"
855 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
856 "bool homogeneous" : false,
857 "bool vexpand" : false,
862 "Gtk.CssProvider css" : "",
863 "bool hexpand" : true,
864 "id" : "search_entry",
870 "(keyval, keycode, state) => {",
872 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
873 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
874 "\t\t_this.forwardSearch(true);",
879 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
880 "\t\t_this.forwardSearch(true);",
886 " // print(event.key.keyval)",
893 "xtype" : "EventControllerKey"
900 "_this.search(_this.search_entry.el.text);",
901 "\t _this.search_results.updateResults();",
903 "\tGLib.Timeout.add_seconds(1,() => {",
904 "\t\t _this.search_results.updateResults();",
905 "\t\t return false;",
911 "string name" : "editor-search-entry",
912 "string placeholder_text" : "Press enter to search",
913 "uint search_delay" : 3,
914 "xtype" : "SearchEntry",
915 "| void forwardSearch" : [
916 "(bool change_focus) {",
919 "\t_this.forwardSearch(change_focus);",
923 "\tswitch(_this.windowstate.state) {",
924 "\t\tcase WindowState.State.CODEONLY:",
925 "\t\t//case WindowState.State.CODE:",
926 "\t\t\t// search the code being edited..",
927 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
930 "\t\tcase WindowState.State.PREVIEW:",
931 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
932 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
934 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
947 "id" : "search_results",
948 "int margin_end" : 4,
949 "int margin_start" : 4,
950 "string label" : "No Results",
952 "| void updateResults" : [
954 "\tthis.el.visible = true;",
956 "\tvar res = _this.searchcontext.get_occurrences_count();",
958 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
962 "\t_this.nextBtn.el.sensitive = false;",
963 "\t_this.backBtn.el.sensitive = false;\t",
966 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
967 "\t\t_this.nextBtn.el.sensitive = true;",
968 "\t\t_this.backBtn.el.sensitive = true;",
971 "\t_this.search_results.el.label = \"No Matches\";",
978 "bool always_show_image" : true,
979 "bool sensitive" : false,
985 "\t_this.forwardSearch(true);",
992 "string icon_name" : "go-down",
997 "bool always_show_image" : true,
998 "bool sensitive" : false,
1004 "\t_this.backSearch(true);",
1010 "string icon_name" : "go-up",
1015 "bool always_show_arrow" : true,
1016 "bool always_show_image" : true,
1020 "* prop" : "popover",
1021 "id" : "search_settings",
1026 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1033 "\tthis.el.show();",
1037 "id" : "case_sensitive",
1038 "string label" : "Case Sensitive",
1039 "xtype" : "CheckButton"
1045 "\tthis.el.show();",
1050 "string label" : "Regex",
1051 "xtype" : "CheckButton"
1056 "string label" : "Multi-line (add \\n)",
1057 "xtype" : "CheckButton"
1066 "string icon_name" : "emblem-system",
1067 "xtype" : "MenuButton"
1077 "* prop" : "end_child",
1078 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1079 "bool hexpand" : true,
1080 "bool vexpand" : true,
1081 "bool visible" : false,
1082 "id" : "navigation_holder",
1084 "int width_request" : 120,
1088 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1094 "bool hexpand" : true,
1095 "bool vexpand" : true,
1096 "bool visible" : true,
1097 "id" : "navigationwindow",
1100 "# int last_selected_line" : "-1",
1101 "$ Gtk.Widget? selected_row" : "null",
1104 "id" : "navigation",
1108 "bool expand" : true,
1112 "* prop" : "factory",
1117 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1119 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1120 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1123 "\tvar hbox = (Gtk.Box) expand.child;",
1126 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1127 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1129 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1130 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1132 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1133 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1135 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1137 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1139 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1140 " \texpand.set_list_row(lr);",
1141 " \t//this.in_bind = true;",
1142 " \t// default is to expand",
1144 " \t//this.in_bind = false;",
1146 " \tsym.bind_property(\"symbol_icon\",",
1147 " img, \"icon_name\",",
1148 " GLib.BindingFlags.SYNC_CREATE);",
1150 " \thbox.css_classes = { sym.symbol_icon };",
1152 " \tsym.bind_property(\"name\",",
1154 " GLib.BindingFlags.SYNC_CREATE);",
1155 " \t// should be better?- --line no?",
1156 " \tsym.bind_property(\"tooltip\",",
1157 " lbl, \"tooltip_markup\",",
1158 " GLib.BindingFlags.SYNC_CREATE);",
1159 " \t// bind image...",
1167 "\tvar expand = new Gtk.TreeExpander();",
1169 "\texpand.set_indent_for_depth(true);",
1170 "\texpand.set_indent_for_icon(true);",
1171 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1172 "\tvar icon = new Gtk.Image();",
1173 "\tvar lbl = new Gtk.Label(\"\");",
1174 "\tlbl.use_markup = true;",
1175 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1177 "\ticon.margin_end = 4;",
1178 " \tlbl.justify = Gtk.Justification.LEFT;",
1179 " \tlbl.xalign = 0;",
1181 "//\tlistitem.activatable = true; ??",
1183 "\thbox.append(icon);",
1184 "\thbox.append(lbl);",
1185 "\texpand.set_child(hbox);",
1186 "\t((Gtk.ListItem)listitem).set_child(expand);",
1192 "xtype" : "SignalListItemFactory"
1195 "string title" : "Code Navigation",
1196 "xtype" : "ColumnViewColumn"
1201 "id" : "navigationselmodel",
1206 "id" : "navigationsort",
1209 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1212 "\treturn ((Lsp.DocumentSymbol)item).children;",
1218 "bool autoexpand" : true,
1219 "bool passthrough" : false,
1222 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1225 "id" : "navliststore",
1226 "xtype" : "ListStore",
1227 "| Lsp.DocumentSymbol? symbolAtLine" : [
1228 "(uint line, uint chr) {",
1231 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1232 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1233 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1234 "\t\t//\tel.name , (int)el.range.start.line,",
1235 "\t\t//\t(int)el.range.end.line",
1237 "\t\tvar ret = el.containsLine(line,chr);",
1238 "\t\tif (ret != null) {",
1239 "\t\t\treturn ret;",
1251 "(position, removed, added) => {",
1252 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1253 "\t if (added < 1) { ",
1256 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1257 "\tvar row = this.el.get_row(position);",
1259 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1266 "xtype" : "TreeListModel"
1270 "* prop" : "sorter",
1274 "* prop" : "sorter",
1277 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1279 "* prop" : "expression",
1280 "string property_name" : "sort_key",
1281 "xtype" : "PropertyExpression"
1284 "xtype" : "StringSorter"
1287 "xtype" : "TreeListRowSorter"
1290 "xtype" : "SortListModel",
1291 "| Lsp.DocumentSymbol? getSymbolAt" : [
1294 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1296 " var a = tr.get_item();; ",
1297 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1300 " return (Lsp.DocumentSymbol)tr.get_item();",
1304 "| int getRowFromSymbol" : [
1305 "(Lsp.DocumentSymbol sym) {",
1307 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1308 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1310 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1317 "| void collapseOnLoad" : [
1319 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1320 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1321 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1322 "\t\tswitch (sym.kind) {",
1323 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1324 "\t \t\t\ttr.expanded = false;",
1327 "\t\t\t\t//tr.expanded = true;",
1339 "xtype" : "NoSelection"
1345 "(n_press, x, y) => {",
1347 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1349 " if (row == null) {",
1350 "\t GLib.debug(\"no row selected items\");",
1353 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1354 " //Lsp.DocumentSymbol",
1355 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1356 " if (sym == null) {",
1362 " \"line\" : 1410,",
1363 " \"character\" : 8",
1366 " \"line\" : 1410,",
1367 " \"character\" : 39",
1371 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1372 " _this.scroll_to_line((int)sym.range.start.line);",
1373 " Gtk.TextIter iter;",
1374 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1375 " \t(int)sym.range.start.line,",
1376 " \t(int)sym.range.start.character",
1378 " _this.buffer.el.place_cursor(iter);",
1383 "xtype" : "GestureClick"
1386 "string name" : "editor-navigation",
1387 "xtype" : "ColumnView",
1388 "| Gtk.Widget? getRowWidgetAt" : [
1389 "(double x, double y, out string pos) {",
1392 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1393 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1394 "\tif (w == null) {",
1398 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1399 "\tif (row == null) {",
1403 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1407 "\t//GLib.debug(\"row number is %d\", rn);",
1408 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1409 "\t// above or belw",
1410 "\tGraphene.Rect bounds;",
1411 "\trow.compute_bounds(this.el, out bounds);",
1412 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1413 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1414 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1416 "\tvar ypos = y - bounds.get_y();",
1417 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1418 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1419 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1420 "\tpos = \"over\";",
1422 "\tif (rpos > 80) {",
1423 "\t\tpos = \"below\";",
1424 "\t} else if (rpos < 20) {",
1425 "\t\tpos = \"above\";",
1430 "| int getRowAt" : [
1431 "(double x, double y, out string pos) {",
1434 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1435 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1436 "\tif (w == null) {",
1440 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1441 "\tif (row == null) {",
1445 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1450 "\twhile (cr.get_prev_sibling() != null) {",
1452 "\t\tcr = cr.get_prev_sibling();",
1455 "\t//GLib.debug(\"row number is %d\", rn);",
1456 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1457 "\t// above or belw",
1458 "\tGraphene.Rect bounds;",
1459 "\trow.compute_bounds(this.el, out bounds);",
1460 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1461 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1462 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1464 "\tvar ypos = y - bounds.get_y();",
1465 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1466 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1467 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1468 "\tpos = \"over\";",
1470 "\tif (rpos > 80) {",
1471 "\t\tpos = \"below\";",
1472 "\t} else if (rpos < 20) {",
1473 "\t\tpos = \"above\";",
1479 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1481 "\tif (!_this.navigation_holder.el.visible) {",
1482 "\t\t_this.navigation_holder.el.show();",
1483 "\t\t_this.paned.el.position = ",
1484 "\t\t\t_this.paned.el.get_width() - 200;",
1486 "\t//_this.navliststore.el.remove_all();",
1489 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1491 "\tforeach(var sym in syms) {",
1492 "\t\tls.append(sym);",
1494 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1495 "\t//_this.navliststore.el.append(sym);",
1496 "\tthis.last_selected_line = -1;",
1497 "\tGLib.Idle.add(() => {",
1498 "\t\t_this.navigationsort.collapseOnLoad();",
1499 "\t\tGtk.TextIter iter;",
1500 "\t\t_this.buffer.el.get_iter_at_offset (",
1501 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1503 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1504 "\t\t\t\titer.get_line_offset());",
1505 "\t\tthis.updateSelectedLine(",
1506 "\t\t\t\t(uint)iter.get_line(),",
1507 "\t\t\t\t(uint)iter.get_line_offset()",
1509 "\t\treturn false;",
1514 "| void updateSelectedLine" : [
1515 "(uint line, uint chr) {",
1516 "\tif (line == this.last_selected_line) {",
1519 "\tGLib.debug(\"select line %d\", (int)line);",
1520 "\tthis.last_selected_line = (int)line;",
1523 "\tvar new_row = -1;",
1524 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1525 "\tif (sym != null) {",
1526 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1527 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1529 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1532 "\tif (this.selected_row != null) { ",
1533 "\t\tGLib.debug(\" remove selected row\");",
1534 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1536 "\tthis.selected_row = null;",
1537 "\tif (new_row > -1) {",
1538 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1539 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1540 "\t\tif (row != null) {",
1541 "\t\t\tGLib.debug(\" Add selected row\");",
1543 "\t\t\trow.add_css_class(\"selected-row\");",
1544 "\t\t\tthis.selected_row = row;",
1548 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1558 "xtype" : "ScrolledWindow"
1568 "| bool saveContents" : [
1572 " if (_this.file == null) {",
1578 " var str = _this.buffer.toString();",
1580 " _this.buffer.checkSyntax();",
1584 " // LeftPanel.model.changed( str , false);",
1585 " _this.dirty = false;",
1586 " _this.save_button.el.sensitive = false;",
1588 " // find the text for the node..",
1589 " if (_this.file.xtype != \"PlainFile\") {",
1590 " // in theory these properties have to exist!?!",
1591 " \tthis.prop.val = str;",
1592 " //this.window.windowstate.left_props.reload();",
1594 " _this.file.setSource( str );",
1597 " // call the signal..",
1605 "(string in_txt) {",
1607 "\tvar s = new GtkSource.SearchSettings();",
1608 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1609 "\ts.regex_enabled = _this.regex.el.active;\t",
1610 "\ts.wrap_around = false;",
1612 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1613 "\tthis.searchcontext.set_highlight(true);",
1614 "\tvar txt = in_txt;",
1616 "\tif (_this.multiline.el.active) {",
1617 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1620 "\ts.set_search_text(txt);",
1621 "\tGtk.TextIter beg, st,en;",
1623 "\tthis.buffer.el.get_start_iter(out beg);",
1624 "\tbool has_wrapped_around;",
1625 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1626 "\tthis.last_search_end = 0;",
1628 "\treturn this.searchcontext.get_occurrences_count();",
1636 "| string tempFileContents" : [
1640 " if (_this.file == null) {",
1643 "\tvar str= this.buffer.toString();",
1644 "\tif (_this.file.xtype == \"PlainFile\") {",
1652 " GLib.debug(\"calling validate\"); ",
1653 " // clear the buttons.",
1654 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1655 "\t\treturn this.file.toSource(); ;",
1658 "\tvar oldcode = _this.prop.val;",
1659 "\t_this.prop.val = str;",
1660 " var ret = _this.file.toSource();",
1661 " _this.prop.val = oldcode;",
1666 "| void backSearch" : [
1667 "(bool change_focus) {",
1669 "\tif (this.searchcontext == null) {",
1673 "\tGtk.TextIter beg, st,en;",
1674 "\tbool has_wrapped_around;",
1675 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1677 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1678 "\t\tthis.last_search_end = 0;",
1680 "\t\tthis.last_search_end = en.get_offset();",
1681 "\t\tif (change_focus) {",
1682 "\t\t\tthis.view.el.grab_focus();",
1684 "\t\tthis.buffer.el.place_cursor(st);",
1685 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1691 "| void forwardSearch" : [
1692 "(bool change_focus) {",
1694 "\tif (this.searchcontext == null) {",
1698 "\tGtk.TextIter beg, st,en;",
1699 "\t bool has_wrapped_around;",
1700 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1701 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1703 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1705 "\t\tif (has_wrapped_around) {",
1709 "\t\tthis.last_search_end = en.get_offset();",
1710 "\t\tif (change_focus) {",
1711 "\t\t\tthis.view.el.grab_focus();",
1713 "\t\tthis.buffer.el.place_cursor(st);",
1714 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1722 "\t this.file = null; ",
1724 " this.node = null;",
1725 " this.prop = null;",
1726 "\tthis.searchcontext = null;",
1731 "| void scroll_to_line" : [
1734 "\tGLib.Timeout.add(500, () => {",
1736 "\t\tvar buf = this.view.el.get_buffer();",
1738 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1741 "\t\tGtk.TextIter iter; ",
1742 "\t\tsbuf.get_iter_at_line(out iter, line);",
1743 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1744 "\t\treturn false;",
1750 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1753 " if (this.file != null) {",
1754 " \tthis.file.navigation_tree_updated.disconnect(",
1755 " \t\t_this.navigation.show",
1758 " this.file = file; ",
1759 " this.file.navigation_tree_updated.connect(",
1760 "\t\t_this.navigation.show",
1762 " if (file.xtype != \"PlainFile\") {",
1763 " \tthis.prop = prop;",
1764 " this.node = node;",
1766 " // find the text for the node..",
1767 " this.view.load( prop.val );",
1768 " this.updateErrorMarks();",
1772 " this.close_btn.el.show(); ",
1775 " this.view.load( file.toSource() );",
1776 " this.updateErrorMarks();",
1777 " this.close_btn.el.hide();",
1778 " var ls = file.getLanguageServer();",
1779 " ls.queueDocumentSymbols(file);",
1780 " ////ls.documentSymbols.begin(file, (a,o) => {",
1781 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1783 " //documentSymbols",
1789 "| void updateErrorMarks" : [
1794 "\tvar buf = _this.buffer.el;",
1795 "\tGtk.TextIter start;",
1796 "\tGtk.TextIter end; ",
1797 "\tbuf.get_bounds (out start, out end);",
1802 "\t//GLib.debug(\"highlight errors\");\t\t ",
1804 "\t // we should highlight other types of errors..",
1806 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1808 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1810 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1816 "\tif (_this.file == null) {",
1817 "\t\tGLib.debug(\"file is null?\");",
1821 "\tvar ar = this.file.getErrors();",
1822 "\tif (ar.size < 1) {",
1823 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1824 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1825 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1826 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1827 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1828 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1829 "\t\tthis.last_error_counter = file.error_counter ;",
1830 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1835 " // basicaly check if there is no change, then we do not do any update..",
1836 " // we can do this by just using an error counter?",
1837 " // if that's changed then we will do an update, otherwise dont bother.",
1840 "\tvar offset = 0;",
1841 "\tvar hoffset = 0;",
1843 "\tvar tlines = buf.get_line_count () +1;",
1845 "\tif (_this.prop != null) {",
1846 "\t\t// this still seems flaky...",
1848 "\t\ttlines = _this.prop.end_line;",
1849 "\t\toffset = _this.prop.start_line;",
1850 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1854 "\t\t// no update...",
1855 "\t\tif (this.last_error_counter == file.error_counter) {",
1861 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1862 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1863 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1864 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1865 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1866 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1868 "\tforeach(var diag in ar) { ",
1869 "\t Gtk.TextIter iter;",
1870 "// print(\"get inter\\n\");",
1871 "\t var eline = (int)diag.range.start.line - offset;",
1872 "\t var eline_to = (int)diag.range.end.line - offset;",
1873 "\t //var eline = diag.range.end_line - offset;",
1874 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1875 "\t //\terr.line ,eline, offset);",
1878 "\t if (eline > tlines || eline < 0) {",
1882 "\t buf.get_iter_at_line( out iter, eline);",
1883 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1884 "\t buf.create_source_mark( msg, diag.category, iter);",
1886 " \t var spos = (int)diag.range.start.character - hoffset;",
1887 " \t if (spos < 0) { spos =0 ; }",
1888 " \t if (spos > iter.get_chars_in_line()) {",
1889 " \t \tspos = iter.get_chars_in_line();",
1891 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1892 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1893 " \t if (epos < 0) { epos =0 ; }",
1894 " \t if (epos > iter.get_chars_in_line()) {",
1895 " \t \tepos = iter.get_chars_in_line();",
1899 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1901 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1903 "\t buf.apply_tag_by_name(diag.category, start, end);",
1905 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1906 "\t //this.marks.set(eline, msg);",
1908 "\tthis.last_error_counter = file.error_counter ;",