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",
31 "* prop" : "start_child",
32 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
36 "$ homogeneous" : false,
38 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
39 "bool hexpand" : true,
40 "bool vexpand" : false,
44 "bool vexpand" : true,
50 " _this.saveContents();",
59 "bool hexpand" : true,
62 "int margin_start" : 4,
64 "| void setHelper" : [
65 "(Lsp.Hover? help) {",
66 "\tif (help == null) {",
67 "\t\tthis.el.set_text(\"\");",
70 "\tvar sig = help.contents.get(0).value.split(\" \");",
71 "\tstring[] str = [];",
72 "\tfor(var i =0; i < sig.length; i++) {",
73 "\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
74 "\t\t\tGLib.Markup.escape_text(sig[i])",
75 "\t\t\t+\"</span>\");",
76 "\tif (\thelp.contents.size() > 1) {",
77 "\t\tsig += (\"\\m\\m\" + help.contents[1].value);",
80 "\tthis.el.set_markup(str.join(\" \"));",
87 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
90 "\t//this.el.set_range(6,30);",
91 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
92 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
94 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
95 " \t\t//\tGLib.debug(\"update range\");",
96 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
97 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
105 "bool draw_value" : false,
106 "bool has_origin" : true,
107 "bool sensitive" : true,
109 "int width_request" : 200,
113 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
116 " \tBuilderApplication.settings.editor_font_size = val;",
130 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
131 "string icon_name" : "window-close",
138 " _this.saveContents();",
139 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
144 "string icon_name" : "window-close",
152 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
153 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
154 "bool overlay_scrolling" : false,
155 "bool vexpand" : true,
156 "id" : "RightEditor",
159 "# Gtk.CssProvider css" : "null",
160 "$ gboolean auto_indent" : true,
161 "$ xns" : "GtkSource",
168 "this.el.completion.add_provider(",
169 "\tnew Palete.CompletionProvider(_this)",
172 "// hover seems pretty useless.. - ??",
173 "//var hover = this.el.get_hover();",
174 "//hover.add_provider(new Palete.HoverProvider(_this));",
176 "//this.el.completion.unblock_interactive();",
177 "this.el.completion.select_on_show = true; // select",
178 "//this.el.completion.remember_info_visibility\t = true;",
181 "var attrs = new GtkSource.MarkAttributes();",
183 "attrs.set_icon_name ( \"process-stop\"); ",
184 "attrs.query_tooltip_text.connect(( mark) => {",
185 " GLib.debug(\"tooltip query? %s\", mark.name);",
186 " return strdup( mark.name);",
188 " attrs.query_tooltip_markup.connect(( mark) => {",
189 " GLib.debug(\"tooltip query? %s\", mark.name);",
190 " return strdup( mark.name);",
192 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
196 "var wattrs = new GtkSource.MarkAttributes();",
197 "wattrs.set_icon_name ( \"process-stop\"); ",
198 "wattrs.query_tooltip_text.connect(( mark) => {",
199 " GLib.debug(\"tooltip query? %s\", mark.name);",
200 " return strdup(mark.name);",
202 "wattrs.query_tooltip_markup.connect(( mark) => {",
203 " GLib.debug(\"tooltip query? %s\", mark.name);",
204 " return strdup(mark.name);",
206 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
210 "var dattrs = new GtkSource.MarkAttributes();",
212 "dattrs.set_icon_name ( \"process-stop\"); ",
214 "dattrs.query_tooltip_text.connect(( mark) => {",
215 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
216 " return strdup(mark.name);",
218 "//dattrs.query_tooltip_markup.connect(( mark) => {",
219 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
220 " // return strdup(mark.name);",
222 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
225 " this.el.get_space_drawer().set_matrix(null);",
226 " this.el.get_space_drawer().set_types_for_locations( ",
227 "\tGtkSource.SpaceLocationFlags.ALL,",
228 "\tGtkSource.SpaceTypeFlags.ALL",
230 "this.el.get_space_drawer().set_enable_matrix(true);",
234 "bool has_tooltip" : true,
235 "bool hexpand" : true,
236 "bool insert_spaces_instead_of_tabs" : true,
237 "bool vexpand" : true,
238 "boolean show_line_marks" : true,
239 "boolean show_line_numbers" : true,
240 "css_classes" : "{ \"code-editor\" }",
241 "gboolean highlight_current_line" : true,
246 "$ Gee.HashMap<int,string>? xmarks" : "null",
247 "$ xns" : "GtkSource",
248 "$ xtype" : "Buffer",
251 "var buf = this.el;",
252 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
253 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
254 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
255 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
256 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
257 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
258 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
259 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
262 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
263 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
264 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
270 "bool check_queued" : false,
271 "bool enable_undo" : true,
272 "bool highlight_matching_brackets" : true,
273 "bool highlight_syntax" : true,
275 "int error_line" : "-1",
279 " // check syntax??",
281 " _this.save_button.el.sensitive = true;",
282 " print(\"EDITOR CHANGED\");",
283 " this.checkSyntax();",
285 " _this.dirty = true;",
287 " // this.get('/LeftPanel.model').changed( str , false);",
295 "\tGtk.TextIter iter;",
296 "\tthis.el.get_iter_at_offset (",
297 "\t\t\tout iter, this.el.cursor_position);",
299 "\t_this.navigation.updateSelectedLine(",
300 "\t\t\t(uint)iter.get_line(),",
301 "\t\t\t(uint)iter.get_line_offset()",
309 "| bool OLDhighlightErrorsJson" : [
310 "(string type, Json.Object obj) {",
311 "\tGtk.TextIter start;",
312 "\tGtk.TextIter end; ",
313 "\tthis.el.get_bounds (out start, out end);",
315 "\tthis.el.remove_source_marks (start, end, type);",
316 "\tGLib.debug(\"highlight errors\");\t\t ",
318 "\t // we should highlight other types of errors..",
320 "\tif (!obj.has_member(type)) {",
321 "\t\tGLib.debug(\"Return has no errors\\n\");",
325 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
327 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
329 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
334 "\t//this.marks = new Gee.HashMap<int,string>();",
335 "\tvar err = obj.get_object_member(type);",
337 "\tif (_this.file == null) {",
338 "\t\tGLib.debug(\"file is null?\");",
342 "\tvar valafn = _this.file.path;",
344 "\tif (_this.file.xtype != \"PlainFile\") {",
346 "\t\tvalafn = \"\";",
348 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
349 "\t\t\t// should not happen",
350 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
351 "\t\t} catch (GLib.RegexError e) {",
352 "\t\t\treturn true;",
358 "\tif (!err.has_member(valafn)) {",
359 "\t\tGLib.debug(\"File path has no errors\");",
363 "\tvar lines = err.get_object_member(valafn);",
366 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
367 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
371 "\tvar tlines = this.el.get_line_count () +1;",
373 "\tif (_this.prop != null) {",
375 "\t\ttlines = _this.prop.end_line + 1;",
376 "\t\toffset = _this.prop.start_line + 1;",
382 "\tlines.foreach_member((obj, line, node) => {",
384 "\t Gtk.TextIter iter;",
385 "// print(\"get inter\\n\");",
386 "\t var eline = int.parse(line) - offset;",
387 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
390 "\t if (eline > tlines || eline < 0) {",
395 "\t this.el.get_iter_at_line( out iter, eline);",
396 "\t //print(\"mark line\\n\");",
397 "\t var msg = \"\";",
398 "\t var ar = lines.get_array_member(line);",
399 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
400 "\t \tif (ar.get_string_element(i) == \"Success\") {",
403 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
404 "\t\t\tmsg += ar.get_string_element(i);",
406 "\t\tif (msg == \"\") {",
409 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
410 "\t this.el.create_source_mark(msg, type, iter);",
411 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
412 "\t // this.marks.set(eline, msg);",
423 "| bool checkSyntax" : [
427 " var str = this.toString();",
430 " if (this.error_line > 0) {",
431 " Gtk.TextIter start;",
432 " Gtk.TextIter end; ",
433 " this.el.get_bounds (out start, out end);",
435 " this.el.remove_source_marks (start, end, null);",
437 " if (str.length < 1) {",
438 " print(\"checkSyntax - empty string?\\n\");",
442 " // bit presumptiona",
443 " if (_this.file.xtype == \"PlainFile\") {",
445 " // assume it's gtk...",
446 " var oldcode =_this.file.toSource();",
447 " _this.file.setSource(str);",
448 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
449 " \t_this.file.getLanguageServer().document_change(_this.file);",
450 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
451 " _this.file.setSource(oldcode);",
457 " if (_this.file == null) {",
465 " GLib.debug(\"calling validate\"); ",
466 " // clear the buttons.",
467 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
470 "\tvar oldcode = _this.prop.val;",
472 "\t_this.prop.val = str;",
473 "\t_this.node.updated_count++;",
474 " _this.file.getLanguageServer().document_change(_this.file);",
475 " _this.node.updated_count++;",
476 " _this.prop.val = oldcode;",
479 " //print(\"done mark line\\n\");",
481 " return true; // at present allow saving - even if it's invalid..",
485 "| bool highlightErrors" : [
486 "( Gee.HashMap<int,string> validate_res) {",
488 "\tthis.error_line = validate_res.size;",
490 "\tif (this.error_line < 1) {",
493 "\tvar tlines = this.el.get_line_count ();",
494 "\tGtk.TextIter iter;",
495 "\tvar valiter = validate_res.map_iterator();",
496 "\twhile (valiter.next()) {",
498 "\t// print(\"get inter\\n\");",
499 "\t\tvar eline = valiter.get_key();",
500 "\t\tif (eline > tlines) {",
503 "\t\tthis.el.get_iter_at_line( out iter, eline);",
504 "\t\t//print(\"mark line\\n\");",
505 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
510 "| string toString" : [
515 " this.el.get_start_iter(out s);",
516 " this.el.get_end_iter(out e);",
517 " var ret = this.el.get_text(s,e,true);",
518 " //print(\"TO STRING? \" + ret);",
525 "# bool is_control" : false,
530 "(keyval, keycode, state) => {",
532 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
533 " \t\tthis.is_control = true;",
540 "(keyval, keycode, state) => {",
542 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
543 " \t\tthis.is_control = false;",
545 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
546 " GLib.debug(\"SAVE: ctrl-S pressed\");",
547 " _this.saveContents();",
551 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
552 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
553 "\t\t_this.forwardSearch(true);",
556 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
557 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
558 "\t\t_this.search_entry.el.grab_focus();",
559 "\t\t_this.search_entry.el.select_region(0,-1);",
562 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
563 "\t\t_this.view.el.show_completion();",
566 "\tGtk.TextIter iter;",
567 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
568 "\tvar line = iter.get_line();",
569 "\tvar offset = iter.get_line_offset();",
570 "\tGLib.debug(\"line %d off %d\", line ,offset);",
571 "\tif (_this.prop != null) {",
572 "\t\tline += _this.prop.start_line + 1; // i think..",
573 "\t\toffset += 12; // should probably be 8 without namespaced ",
574 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
576 " //_this.view.el.show_completion();",
577 " // print(event.key.keyval)",
587 "xtype" : "EventControllerKey"
590 "# double distance" : "0.0f",
592 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
596 "\tif (!_this.keystate.is_control) {",
599 "\t //GLib.debug(\"scroll %f\", dy);",
601 "\tthis.distance += dy;",
603 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
605 "\t if (this.distance < -1) {",
607 "\t\tBuilderApplication.settings.editor_font_size ++;",
608 "\t\tthis.distance = 0;",
610 "\tif (this.distance > 1) {",
611 "\t\tBuilderApplication.settings.editor_font_size --;",
612 "\t\tthis.distance = 0;",
620 "xtype" : "EventControllerScroll"
626 "(n_press, x, y) => {",
627 "\tGtk.TextIter iter;",
628 "\tint buffer_x, buffer_y;",
629 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
631 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
632 "\t\t(int)x - gut.get_width(), (int)y,",
633 " \t\tout buffer_x, out buffer_y);",
634 "\t_this.view.el.get_iter_at_location (out iter, ",
635 "\t\t\tbuffer_x, buffer_y);;",
638 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
639 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
643 "\tvar back = iter.copy();",
644 "\tback.backward_char();",
646 "\tvar forward = iter.copy();",
647 "\tforward.forward_char();",
649 "\t// what's the character at the iter?",
650 "\tvar str = back.get_text(iter);",
651 "\tstr += iter.get_text(forward);",
652 "\tif (str.strip().length < 1) {",
655 "\tvar offset = iter.get_line_offset();",
656 "\tvar line = iter.get_line();",
657 "\tif (_this.prop != null) {",
659 "\t\tline += _this.prop.start_line ; ",
660 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
661 "\t\toffset += _this.node.node_pad.length;",
662 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
663 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
664 "\t\t\toffset += 2;",
668 "\tvar ls = _this.file.getLanguageServer();",
670 "\t\t_this.file, line, offset,",
672 "\t\t\tvar res = ls.hover.end(o );",
673 "\t\t\t_this.helper.setHelp(res);",
677 "\t\t\tthings that can ber returned..",
678 "\t\t\t\"int\" (type only)",
680 "\t\t\tEditor xxxx._thisJ",
681 "\t\t\tJsrennder.jsrender Editor.file ",
682 "\t\t\tPalete.LanguageClient? JsRender.JsRender.getLanguageServer ()",
683 "\t\t\tPalete.LanguageClient? ls = _this.file.getLanguageServer()",
684 "\t\t\tasync Lsp.Hover Palete.LanguageClient.hover (JsRender.JsRender file, int line, int offset) throws GLib.Error",
685 "\t\t\t.string JsRender.Node.node_pad = \\\"\\\" ",
686 "\t\t\tGtk.TextIter iter",
688 "\t\t string Gtk.TextIter.get_text (Gtk.TextIter end)",
693 "\t\t // could never get this to work anywhere..",
694 "\t\t // looks like its probably for calling stuff..",
695 "\t\t // but always returns null..",
697 "\tls.signatureHelp.begin(",
698 "\t\t_this.file, iter.get_line(), iter.get_line_offset(),",
700 "\t\t\tvar res = ls.signatureHelp.end(o );",
709 "xtype" : "GestureClick"
714 "(x, y, keyboard_tooltip, tooltip) => {",
716 "\t//GLib.debug(\"query tooltip\");",
717 "\tGtk.TextIter iter;",
720 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
722 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
724 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
725 "\t//\treturn false;",
728 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
730 "\tvar l = iter.get_line();",
734 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
740 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
741 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
742 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
750 "\t// this crashes?? - not sure why.",
751 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
752 "\tif (marks.is_empty()) {",
753 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
755 "\tif (marks.is_empty()) {",
756 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
759 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
761 "\tmarks.@foreach((m) => { ",
762 "\t\t//GLib.debug(\"got mark %s\", m.name);",
763 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
765 "\t// true if there is a mark..",
766 "\tif (str.length > 0 ) {",
767 "\t\ttooltip.set_text( str );",
769 "\treturn str.length > 0 ? true : false;",
775 "string name" : "editor-view",
776 "uint tab_width" : 4,
781 "// show the help page for the active node..",
782 " //this.get('/Help').show();",
784 " // this.get('/BottomPane').el.set_current_page(0);",
785 " \tGLib.debug(\"load called - Reset undo buffer\");",
787 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
788 " buf.begin_irreversible_action();",
789 " buf.set_text(str, str.length);",
790 " buf.end_irreversible_action();",
792 " var lm = GtkSource.LanguageManager.get_default();",
793 " var lang = \"vala\";",
794 " if (_this.file != null) {",
795 " lang = _this.file.language;",
797 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
798 " var lg = _this.file.content_type.length > 0 ?",
799 " lm.guess_language(_this.file.path, _this.file.content_type) :",
800 " lm.get_language(lang);",
803 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
805 " this.el.insert_spaces_instead_of_tabs = true;",
806 " if (lg != null) {",
807 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
808 "\t\tif (lg.name == \"Vala\") {",
809 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
812 " _this.dirty = false;",
813 " this.el.grab_focus();",
814 " _this.save_button.el.sensitive = false;",
815 " _this.last_error_counter = -1;",
820 "xtype" : "ScrolledWindow"
825 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
826 "bool homogeneous" : false,
827 "bool vexpand" : false,
832 "Gtk.CssProvider css" : "",
833 "bool hexpand" : true,
834 "id" : "search_entry",
840 "(keyval, keycode, state) => {",
842 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
843 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
844 "\t\t_this.forwardSearch(true);",
849 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
850 "\t\t_this.forwardSearch(true);",
856 " // print(event.key.keyval)",
863 "xtype" : "EventControllerKey"
870 "_this.search(_this.search_entry.el.text);",
871 "\t _this.search_results.updateResults();",
873 "\tGLib.Timeout.add_seconds(1,() => {",
874 "\t\t _this.search_results.updateResults();",
875 "\t\t return false;",
881 "string name" : "editor-search-entry",
882 "string placeholder_text" : "Press enter to search",
883 "uint search_delay" : 3,
884 "xtype" : "SearchEntry",
885 "| void forwardSearch" : [
886 "(bool change_focus) {",
889 "\t_this.forwardSearch(change_focus);",
893 "\tswitch(_this.windowstate.state) {",
894 "\t\tcase WindowState.State.CODEONLY:",
895 "\t\t//case WindowState.State.CODE:",
896 "\t\t\t// search the code being edited..",
897 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
900 "\t\tcase WindowState.State.PREVIEW:",
901 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
902 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
904 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
917 "id" : "search_results",
918 "int margin_end" : 4,
919 "int margin_start" : 4,
920 "string label" : "No Results",
922 "| void updateResults" : [
924 "\tthis.el.visible = true;",
926 "\tvar res = _this.searchcontext.get_occurrences_count();",
928 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
932 "\t_this.nextBtn.el.sensitive = false;",
933 "\t_this.backBtn.el.sensitive = false;\t",
936 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
937 "\t\t_this.nextBtn.el.sensitive = true;",
938 "\t\t_this.backBtn.el.sensitive = true;",
941 "\t_this.search_results.el.label = \"No Matches\";",
948 "bool always_show_image" : true,
949 "bool sensitive" : false,
955 "\t_this.forwardSearch(true);",
962 "string icon_name" : "go-down",
967 "bool always_show_image" : true,
968 "bool sensitive" : false,
974 "\t_this.backSearch(true);",
980 "string icon_name" : "go-up",
985 "bool always_show_arrow" : true,
986 "bool always_show_image" : true,
990 "* prop" : "popover",
991 "id" : "search_settings",
996 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1003 "\tthis.el.show();",
1007 "id" : "case_sensitive",
1008 "string label" : "Case Sensitive",
1009 "xtype" : "CheckButton"
1015 "\tthis.el.show();",
1020 "string label" : "Regex",
1021 "xtype" : "CheckButton"
1026 "string label" : "Multi-line (add \\n)",
1027 "xtype" : "CheckButton"
1036 "string icon_name" : "emblem-system",
1037 "xtype" : "MenuButton"
1047 "* prop" : "end_child",
1048 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1049 "bool hexpand" : true,
1050 "bool vexpand" : true,
1055 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1061 "bool hexpand" : true,
1062 "bool vexpand" : true,
1063 "bool visible" : false,
1064 "id" : "navigationwindow",
1067 "# int last_selected_line" : "-1",
1068 "$ Gtk.Widget? selected_row" : "null",
1071 "id" : "navigation",
1075 "bool expand" : true,
1079 "* prop" : "factory",
1084 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1086 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1087 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1090 "\tvar hbox = (Gtk.Box) expand.child;",
1093 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1094 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1096 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1097 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1099 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1100 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1102 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1104 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1106 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1107 " \texpand.set_list_row(lr);",
1108 " \t//this.in_bind = true;",
1109 " \t// default is to expand",
1111 " \t//this.in_bind = false;",
1113 " \tsym.bind_property(\"symbol_icon\",",
1114 " img, \"icon_name\",",
1115 " GLib.BindingFlags.SYNC_CREATE);",
1117 " \thbox.css_classes = { sym.symbol_icon };",
1119 " \tsym.bind_property(\"name\",",
1121 " GLib.BindingFlags.SYNC_CREATE);",
1122 " \t// should be better?- --line no?",
1123 " \tsym.bind_property(\"tooltip\",",
1124 " lbl, \"tooltip_markup\",",
1125 " GLib.BindingFlags.SYNC_CREATE);",
1126 " \t// bind image...",
1134 "\tvar expand = new Gtk.TreeExpander();",
1136 "\texpand.set_indent_for_depth(true);",
1137 "\texpand.set_indent_for_icon(true);",
1138 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1139 "\tvar icon = new Gtk.Image();",
1140 "\tvar lbl = new Gtk.Label(\"\");",
1141 "\tlbl.use_markup = true;",
1142 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1144 "\ticon.margin_end = 4;",
1145 " \tlbl.justify = Gtk.Justification.LEFT;",
1146 " \tlbl.xalign = 0;",
1148 "//\tlistitem.activatable = true; ??",
1150 "\thbox.append(icon);",
1151 "\thbox.append(lbl);",
1152 "\texpand.set_child(hbox);",
1153 "\t((Gtk.ListItem)listitem).set_child(expand);",
1159 "xtype" : "SignalListItemFactory"
1162 "string title" : "Code Navigation",
1163 "xtype" : "ColumnViewColumn"
1168 "id" : "navigationselmodel",
1173 "id" : "navigationsort",
1176 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1179 "\treturn ((Lsp.DocumentSymbol)item).children;",
1185 "bool autoexpand" : true,
1186 "bool passthrough" : false,
1189 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1192 "id" : "navliststore",
1193 "xtype" : "ListStore",
1194 "| Lsp.DocumentSymbol? symbolAtLine" : [
1195 "(uint line, uint chr) {",
1198 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1199 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1200 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1201 "\t\t//\tel.name , (int)el.range.start.line,",
1202 "\t\t//\t(int)el.range.end.line",
1204 "\t\tvar ret = el.containsLine(line,chr);",
1205 "\t\tif (ret != null) {",
1206 "\t\t\treturn ret;",
1218 "(position, removed, added) => {",
1219 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1220 "\t if (added < 1) { ",
1223 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1224 "\tvar row = this.el.get_row(position);",
1226 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1233 "xtype" : "TreeListModel"
1237 "* prop" : "sorter",
1241 "* prop" : "sorter",
1244 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1246 "* prop" : "expression",
1247 "string property_name" : "sort_key",
1248 "xtype" : "PropertyExpression"
1251 "xtype" : "StringSorter"
1254 "xtype" : "TreeListRowSorter"
1257 "xtype" : "SortListModel",
1258 "| Lsp.DocumentSymbol? getSymbolAt" : [
1261 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1263 " var a = tr.get_item();; ",
1264 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1267 " return (Lsp.DocumentSymbol)tr.get_item();",
1271 "| int getRowFromSymbol" : [
1272 "(Lsp.DocumentSymbol sym) {",
1274 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1275 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1277 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1284 "| void collapseOnLoad" : [
1286 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1287 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1288 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1289 "\t\tswitch (sym.kind) {",
1290 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1291 "\t \t\t\ttr.expanded = false;",
1294 "\t\t\t\t//tr.expanded = true;",
1306 "xtype" : "NoSelection"
1312 "(n_press, x, y) => {",
1314 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1316 " if (row == null) {",
1317 "\t GLib.debug(\"no row selected items\");",
1320 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1321 " //Lsp.DocumentSymbol",
1322 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1323 " if (sym == null) {",
1329 " \"line\" : 1410,",
1330 " \"character\" : 8",
1333 " \"line\" : 1410,",
1334 " \"character\" : 39",
1338 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1339 " _this.scroll_to_line((int)sym.range.start.line);",
1340 " Gtk.TextIter iter;",
1341 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1342 " \t(int)sym.range.start.line,",
1343 " \t(int)sym.range.start.character",
1345 " _this.buffer.el.place_cursor(iter);",
1350 "xtype" : "GestureClick"
1353 "string name" : "editor-navigation",
1354 "xtype" : "ColumnView",
1355 "| Gtk.Widget? getRowWidgetAt" : [
1356 "(double x, double y, out string pos) {",
1359 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1360 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1361 "\tif (w == null) {",
1365 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1366 "\tif (row == null) {",
1370 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1374 "\t//GLib.debug(\"row number is %d\", rn);",
1375 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1376 "\t// above or belw",
1377 "\tGraphene.Rect bounds;",
1378 "\trow.compute_bounds(this.el, out bounds);",
1379 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1380 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1381 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1383 "\tvar ypos = y - bounds.get_y();",
1384 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1385 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1386 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1387 "\tpos = \"over\";",
1389 "\tif (rpos > 80) {",
1390 "\t\tpos = \"below\";",
1391 "\t} else if (rpos < 20) {",
1392 "\t\tpos = \"above\";",
1397 "| int getRowAt" : [
1398 "(double x, double y, out string pos) {",
1401 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1402 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1403 "\tif (w == null) {",
1407 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1408 "\tif (row == null) {",
1412 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1417 "\twhile (cr.get_prev_sibling() != null) {",
1419 "\t\tcr = cr.get_prev_sibling();",
1422 "\t//GLib.debug(\"row number is %d\", rn);",
1423 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1424 "\t// above or belw",
1425 "\tGraphene.Rect bounds;",
1426 "\trow.compute_bounds(this.el, out bounds);",
1427 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1428 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1429 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1431 "\tvar ypos = y - bounds.get_y();",
1432 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1433 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1434 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1435 "\tpos = \"over\";",
1437 "\tif (rpos > 80) {",
1438 "\t\tpos = \"below\";",
1439 "\t} else if (rpos < 20) {",
1440 "\t\tpos = \"above\";",
1446 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1447 "\t_this.navigationwindow.el.show();",
1448 "\t//_this.navliststore.el.remove_all();",
1451 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1453 "\tforeach(var sym in syms) {",
1454 "\t\tls.append(sym);",
1456 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1457 "\t//_this.navliststore.el.append(sym);",
1458 "\tthis.last_selected_line = -1;",
1459 "\tGLib.Idle.add(() => {",
1460 "\t\t_this.navigationsort.collapseOnLoad();",
1461 "\t\tGtk.TextIter iter;",
1462 "\t\t_this.buffer.el.get_iter_at_offset (",
1463 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1465 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1466 "\t\t\t\titer.get_line_offset());",
1467 "\t\tthis.updateSelectedLine(",
1468 "\t\t\t\t(uint)iter.get_line(),",
1469 "\t\t\t\t(uint)iter.get_line_offset()",
1471 "\t\treturn false;",
1476 "| void updateSelectedLine" : [
1477 "(uint line, uint chr) {",
1478 "\tif (line == this.last_selected_line) {",
1481 "\tGLib.debug(\"select line %d\", (int)line);",
1482 "\tthis.last_selected_line = (int)line;",
1485 "\tvar new_row = -1;",
1486 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1487 "\tif (sym != null) {",
1488 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1489 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1491 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1494 "\tif (this.selected_row != null) { ",
1495 "\t\tGLib.debug(\" remove selected row\");",
1496 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1498 "\tthis.selected_row = null;",
1499 "\tif (new_row > -1) {",
1500 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1501 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1502 "\t\tif (row != null) {",
1503 "\t\t\tGLib.debug(\" Add selected row\");",
1505 "\t\t\trow.add_css_class(\"selected-row\");",
1506 "\t\t\tthis.selected_row = row;",
1510 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1520 "xtype" : "ScrolledWindow"
1530 "| bool saveContents" : [
1534 " if (_this.file == null) {",
1540 " var str = _this.buffer.toString();",
1542 " _this.buffer.checkSyntax();",
1546 " // LeftPanel.model.changed( str , false);",
1547 " _this.dirty = false;",
1548 " _this.save_button.el.sensitive = false;",
1550 " // find the text for the node..",
1551 " if (_this.file.xtype != \"PlainFile\") {",
1552 " // in theory these properties have to exist!?!",
1553 " \tthis.prop.val = str;",
1554 " //this.window.windowstate.left_props.reload();",
1556 " _this.file.setSource( str );",
1559 " // call the signal..",
1567 "(string in_txt) {",
1569 "\tvar s = new GtkSource.SearchSettings();",
1570 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1571 "\ts.regex_enabled = _this.regex.el.active;\t",
1572 "\ts.wrap_around = false;",
1574 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1575 "\tthis.searchcontext.set_highlight(true);",
1576 "\tvar txt = in_txt;",
1578 "\tif (_this.multiline.el.active) {",
1579 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1582 "\ts.set_search_text(txt);",
1583 "\tGtk.TextIter beg, st,en;",
1585 "\tthis.buffer.el.get_start_iter(out beg);",
1586 "\tbool has_wrapped_around;",
1587 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1588 "\tthis.last_search_end = 0;",
1590 "\treturn this.searchcontext.get_occurrences_count();",
1598 "| string tempFileContents" : [
1602 " if (_this.file == null) {",
1605 "\tvar str= this.buffer.toString();",
1606 "\tif (_this.file.xtype == \"PlainFile\") {",
1614 " GLib.debug(\"calling validate\"); ",
1615 " // clear the buttons.",
1616 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1617 "\t\treturn this.file.toSource(); ;",
1620 "\tvar oldcode = _this.prop.val;",
1621 "\t_this.prop.val = str;",
1622 " var ret = _this.file.toSource();",
1623 " _this.prop.val = oldcode;",
1628 "| void backSearch" : [
1629 "(bool change_focus) {",
1631 "\tif (this.searchcontext == null) {",
1635 "\tGtk.TextIter beg, st,en;",
1636 "\tbool has_wrapped_around;",
1637 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1639 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1640 "\t\tthis.last_search_end = 0;",
1642 "\t\tthis.last_search_end = en.get_offset();",
1643 "\t\tif (change_focus) {",
1644 "\t\t\tthis.view.el.grab_focus();",
1646 "\t\tthis.buffer.el.place_cursor(st);",
1647 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1653 "| void forwardSearch" : [
1654 "(bool change_focus) {",
1656 "\tif (this.searchcontext == null) {",
1660 "\tGtk.TextIter beg, st,en;",
1661 "\t bool has_wrapped_around;",
1662 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1663 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1665 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1667 "\t\tif (has_wrapped_around) {",
1671 "\t\tthis.last_search_end = en.get_offset();",
1672 "\t\tif (change_focus) {",
1673 "\t\t\tthis.view.el.grab_focus();",
1675 "\t\tthis.buffer.el.place_cursor(st);",
1676 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1684 "\t this.file = null; ",
1686 " this.node = null;",
1687 " this.prop = null;",
1688 "\tthis.searchcontext = null;",
1693 "| void scroll_to_line" : [
1696 "\tGLib.Timeout.add(500, () => {",
1698 "\t\tvar buf = this.view.el.get_buffer();",
1700 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1703 "\t\tGtk.TextIter iter; ",
1704 "\t\tsbuf.get_iter_at_line(out iter, line);",
1705 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1706 "\t\treturn false;",
1712 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1715 " if (this.file != null) {",
1716 " \tthis.file.navigation_tree_updated.disconnect(",
1717 " \t\t_this.navigation.show",
1720 " this.file = file; ",
1721 " this.file.navigation_tree_updated.connect(",
1722 "\t\t_this.navigation.show",
1724 " if (file.xtype != \"PlainFile\") {",
1725 " \tthis.prop = prop;",
1726 " this.node = node;",
1728 " // find the text for the node..",
1729 " this.view.load( prop.val );",
1730 " this.updateErrorMarks();",
1734 " this.close_btn.el.show(); ",
1737 " this.view.load( file.toSource() );",
1738 " this.updateErrorMarks();",
1739 " this.close_btn.el.hide();",
1740 " var ls = file.getLanguageServer();",
1741 " ls.queueDocumentSymbols(file);",
1742 " ////ls.documentSymbols.begin(file, (a,o) => {",
1743 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1745 " //documentSymbols",
1751 "| void updateErrorMarks" : [
1756 "\tvar buf = _this.buffer.el;",
1757 "\tGtk.TextIter start;",
1758 "\tGtk.TextIter end; ",
1759 "\tbuf.get_bounds (out start, out end);",
1764 "\t//GLib.debug(\"highlight errors\");\t\t ",
1766 "\t // we should highlight other types of errors..",
1768 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1770 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1772 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1778 "\tif (_this.file == null) {",
1779 "\t\tGLib.debug(\"file is null?\");",
1783 "\tvar ar = this.file.getErrors();",
1784 "\tif (ar.size < 1) {",
1785 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1786 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1787 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1788 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1789 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1790 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1791 "\t\tthis.last_error_counter = file.error_counter ;",
1792 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1797 " // basicaly check if there is no change, then we do not do any update..",
1798 " // we can do this by just using an error counter?",
1799 " // if that's changed then we will do an update, otherwise dont bother.",
1802 "\tvar offset = 0;",
1803 "\tvar hoffset = 0;",
1805 "\tvar tlines = buf.get_line_count () +1;",
1807 "\tif (_this.prop != null) {",
1808 "\t\t// this still seems flaky...",
1810 "\t\ttlines = _this.prop.end_line;",
1811 "\t\toffset = _this.prop.start_line;",
1812 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1816 "\t\t// no update...",
1817 "\t\tif (this.last_error_counter == file.error_counter) {",
1823 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1824 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1825 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1826 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1827 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1828 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1830 "\tforeach(var diag in ar) { ",
1831 "\t Gtk.TextIter iter;",
1832 "// print(\"get inter\\n\");",
1833 "\t var eline = (int)diag.range.start.line - offset;",
1834 "\t var eline_to = (int)diag.range.end.line - offset;",
1835 "\t //var eline = diag.range.end_line - offset;",
1836 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1837 "\t //\terr.line ,eline, offset);",
1840 "\t if (eline > tlines || eline < 0) {",
1844 "\t buf.get_iter_at_line( out iter, eline);",
1845 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1846 "\t buf.create_source_mark( msg, diag.category, iter);",
1848 " \t var spos = (int)diag.range.start.character - hoffset;",
1849 " \t if (spos < 0) { spos =0 ; }",
1850 " \t if (spos > iter.get_chars_in_line()) {",
1851 " \t \tspos = iter.get_chars_in_line();",
1853 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1854 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1855 " \t if (epos < 0) { epos =0 ; }",
1856 " \t if (epos > iter.get_chars_in_line()) {",
1857 " \t \tepos = iter.get_chars_in_line();",
1861 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1863 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1865 "\t buf.apply_tag_by_name(diag.category, start, end);",
1867 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1868 "\t //this.marks.set(eline, msg);",
1870 "\tthis.last_error_counter = file.error_counter ;",