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,
65 "(Lsp.Hover? help) {",
66 "\tif (help == null || help.contents == 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++) {",
74 "\t\tswitch(sig[i]) {",
75 "\t\t\tcase \"public\":",
76 "\t\t\tcase \"private\":",
77 "\t\t\tcase \"protected\":",
78 "\t\t\tcase \"async\":",
84 "\t\t\t\tstr += sig[i];",
90 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
91 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
92 "\t\t\t\t\t+\"</span>\");",
96 "\tif (help.contents.size > 1) {",
97 "\t\tsig += (\"\\n\\n\" + help.contents[1].value);",
100 "\tthis.el.set_markup(string.joinv(\" \",str));",
107 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
110 "\t//this.el.set_range(6,30);",
111 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
112 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
114 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
115 " \t\t//\tGLib.debug(\"update range\");",
116 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
117 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
125 "bool draw_value" : false,
126 "bool has_origin" : true,
127 "bool sensitive" : true,
129 "int width_request" : 200,
133 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
136 " \tBuilderApplication.settings.editor_font_size = val;",
150 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
151 "string icon_name" : "window-close",
158 " _this.saveContents();",
159 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
164 "string icon_name" : "window-close",
172 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
173 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
174 "bool overlay_scrolling" : false,
175 "bool vexpand" : true,
176 "id" : "RightEditor",
179 "# Gtk.CssProvider css" : "null",
180 "$ gboolean auto_indent" : true,
181 "$ xns" : "GtkSource",
188 "this.el.completion.add_provider(",
189 "\tnew Palete.CompletionProvider(_this)",
192 "// hover seems pretty useless.. - ??",
193 "//var hover = this.el.get_hover();",
194 "//hover.add_provider(new Palete.HoverProvider(_this));",
196 "//this.el.completion.unblock_interactive();",
197 "this.el.completion.select_on_show = true; // select",
198 "//this.el.completion.remember_info_visibility\t = true;",
201 "var attrs = new GtkSource.MarkAttributes();",
203 "attrs.set_icon_name ( \"process-stop\"); ",
204 "attrs.query_tooltip_text.connect(( mark) => {",
205 " GLib.debug(\"tooltip query? %s\", mark.name);",
206 " return strdup( mark.name);",
208 " attrs.query_tooltip_markup.connect(( mark) => {",
209 " GLib.debug(\"tooltip query? %s\", mark.name);",
210 " return strdup( mark.name);",
212 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
216 "var wattrs = new GtkSource.MarkAttributes();",
217 "wattrs.set_icon_name ( \"process-stop\"); ",
218 "wattrs.query_tooltip_text.connect(( mark) => {",
219 " GLib.debug(\"tooltip query? %s\", mark.name);",
220 " return strdup(mark.name);",
222 "wattrs.query_tooltip_markup.connect(( mark) => {",
223 " GLib.debug(\"tooltip query? %s\", mark.name);",
224 " return strdup(mark.name);",
226 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
230 "var dattrs = new GtkSource.MarkAttributes();",
232 "dattrs.set_icon_name ( \"process-stop\"); ",
234 "dattrs.query_tooltip_text.connect(( mark) => {",
235 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
236 " return strdup(mark.name);",
238 "//dattrs.query_tooltip_markup.connect(( mark) => {",
239 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
240 " // return strdup(mark.name);",
242 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
245 " this.el.get_space_drawer().set_matrix(null);",
246 " this.el.get_space_drawer().set_types_for_locations( ",
247 "\tGtkSource.SpaceLocationFlags.ALL,",
248 "\tGtkSource.SpaceTypeFlags.ALL",
250 "this.el.get_space_drawer().set_enable_matrix(true);",
254 "bool has_tooltip" : true,
255 "bool hexpand" : true,
256 "bool insert_spaces_instead_of_tabs" : true,
257 "bool vexpand" : true,
258 "boolean show_line_marks" : true,
259 "boolean show_line_numbers" : true,
260 "css_classes" : "{ \"code-editor\" }",
261 "gboolean highlight_current_line" : true,
266 "$ Gee.HashMap<int,string>? xmarks" : "null",
267 "$ xns" : "GtkSource",
268 "$ xtype" : "Buffer",
271 "var buf = this.el;",
272 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
273 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
274 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
275 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
276 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
277 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
278 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
279 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
282 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
283 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
284 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
290 "bool check_queued" : false,
291 "bool enable_undo" : true,
292 "bool highlight_matching_brackets" : true,
293 "bool highlight_syntax" : true,
295 "int error_line" : "-1",
299 " // check syntax??",
301 " _this.save_button.el.sensitive = true;",
302 " print(\"EDITOR CHANGED\");",
303 " this.checkSyntax();",
305 " _this.dirty = true;",
307 " // this.get('/LeftPanel.model').changed( str , false);",
315 "\tGtk.TextIter iter;",
316 "\tthis.el.get_iter_at_offset (",
317 "\t\t\tout iter, this.el.cursor_position);",
319 "\t_this.navigation.updateSelectedLine(",
320 "\t\t\t(uint)iter.get_line(),",
321 "\t\t\t(uint)iter.get_line_offset()",
329 "| bool OLDhighlightErrorsJson" : [
330 "(string type, Json.Object obj) {",
331 "\tGtk.TextIter start;",
332 "\tGtk.TextIter end; ",
333 "\tthis.el.get_bounds (out start, out end);",
335 "\tthis.el.remove_source_marks (start, end, type);",
336 "\tGLib.debug(\"highlight errors\");\t\t ",
338 "\t // we should highlight other types of errors..",
340 "\tif (!obj.has_member(type)) {",
341 "\t\tGLib.debug(\"Return has no errors\\n\");",
345 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
347 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
349 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
354 "\t//this.marks = new Gee.HashMap<int,string>();",
355 "\tvar err = obj.get_object_member(type);",
357 "\tif (_this.file == null) {",
358 "\t\tGLib.debug(\"file is null?\");",
362 "\tvar valafn = _this.file.path;",
364 "\tif (_this.file.xtype != \"PlainFile\") {",
366 "\t\tvalafn = \"\";",
368 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
369 "\t\t\t// should not happen",
370 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
371 "\t\t} catch (GLib.RegexError e) {",
372 "\t\t\treturn true;",
378 "\tif (!err.has_member(valafn)) {",
379 "\t\tGLib.debug(\"File path has no errors\");",
383 "\tvar lines = err.get_object_member(valafn);",
386 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
387 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
391 "\tvar tlines = this.el.get_line_count () +1;",
393 "\tif (_this.prop != null) {",
395 "\t\ttlines = _this.prop.end_line + 1;",
396 "\t\toffset = _this.prop.start_line + 1;",
402 "\tlines.foreach_member((obj, line, node) => {",
404 "\t Gtk.TextIter iter;",
405 "// print(\"get inter\\n\");",
406 "\t var eline = int.parse(line) - offset;",
407 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
410 "\t if (eline > tlines || eline < 0) {",
415 "\t this.el.get_iter_at_line( out iter, eline);",
416 "\t //print(\"mark line\\n\");",
417 "\t var msg = \"\";",
418 "\t var ar = lines.get_array_member(line);",
419 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
420 "\t \tif (ar.get_string_element(i) == \"Success\") {",
423 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
424 "\t\t\tmsg += ar.get_string_element(i);",
426 "\t\tif (msg == \"\") {",
429 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
430 "\t this.el.create_source_mark(msg, type, iter);",
431 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
432 "\t // this.marks.set(eline, msg);",
443 "| bool checkSyntax" : [
447 " var str = this.toString();",
450 " if (this.error_line > 0) {",
451 " Gtk.TextIter start;",
452 " Gtk.TextIter end; ",
453 " this.el.get_bounds (out start, out end);",
455 " this.el.remove_source_marks (start, end, null);",
457 " if (str.length < 1) {",
458 " print(\"checkSyntax - empty string?\\n\");",
462 " // bit presumptiona",
463 " if (_this.file.xtype == \"PlainFile\") {",
465 " // assume it's gtk...",
466 " var oldcode =_this.file.toSource();",
467 " _this.file.setSource(str);",
468 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
469 " \t_this.file.getLanguageServer().document_change(_this.file);",
470 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
471 " _this.file.setSource(oldcode);",
477 " if (_this.file == null) {",
485 " GLib.debug(\"calling validate\"); ",
486 " // clear the buttons.",
487 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
490 "\tvar oldcode = _this.prop.val;",
492 "\t_this.prop.val = str;",
493 "\t_this.node.updated_count++;",
494 " _this.file.getLanguageServer().document_change(_this.file);",
495 " _this.node.updated_count++;",
496 " _this.prop.val = oldcode;",
499 " //print(\"done mark line\\n\");",
501 " return true; // at present allow saving - even if it's invalid..",
505 "| bool highlightErrors" : [
506 "( Gee.HashMap<int,string> validate_res) {",
508 "\tthis.error_line = validate_res.size;",
510 "\tif (this.error_line < 1) {",
513 "\tvar tlines = this.el.get_line_count ();",
514 "\tGtk.TextIter iter;",
515 "\tvar valiter = validate_res.map_iterator();",
516 "\twhile (valiter.next()) {",
518 "\t// print(\"get inter\\n\");",
519 "\t\tvar eline = valiter.get_key();",
520 "\t\tif (eline > tlines) {",
523 "\t\tthis.el.get_iter_at_line( out iter, eline);",
524 "\t\t//print(\"mark line\\n\");",
525 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
530 "| string toString" : [
535 " this.el.get_start_iter(out s);",
536 " this.el.get_end_iter(out e);",
537 " var ret = this.el.get_text(s,e,true);",
538 " //print(\"TO STRING? \" + ret);",
545 "# bool is_control" : false,
550 "(keyval, keycode, state) => {",
552 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
553 " \t\tthis.is_control = true;",
560 "(keyval, keycode, state) => {",
562 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
563 " \t\tthis.is_control = false;",
565 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
566 " GLib.debug(\"SAVE: ctrl-S pressed\");",
567 " _this.saveContents();",
571 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
572 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
573 "\t\t_this.forwardSearch(true);",
576 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
577 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
578 "\t\t_this.search_entry.el.grab_focus();",
579 "\t\t_this.search_entry.el.select_region(0,-1);",
582 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
583 "\t\t_this.view.el.show_completion();",
586 "\tGtk.TextIter iter;",
587 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
588 "\tvar line = iter.get_line();",
589 "\tvar offset = iter.get_line_offset();",
590 "\tGLib.debug(\"line %d off %d\", line ,offset);",
591 "\tif (_this.prop != null) {",
592 "\t\tline += _this.prop.start_line + 1; // i think..",
593 "\t\toffset += 12; // should probably be 8 without namespaced ",
594 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
596 " //_this.view.el.show_completion();",
597 " // print(event.key.keyval)",
607 "xtype" : "EventControllerKey"
610 "# double distance" : "0.0f",
612 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
616 "\tif (!_this.keystate.is_control) {",
619 "\t //GLib.debug(\"scroll %f\", dy);",
621 "\tthis.distance += dy;",
623 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
625 "\t if (this.distance < -1) {",
627 "\t\tBuilderApplication.settings.editor_font_size ++;",
628 "\t\tthis.distance = 0;",
630 "\tif (this.distance > 1) {",
631 "\t\tBuilderApplication.settings.editor_font_size --;",
632 "\t\tthis.distance = 0;",
640 "xtype" : "EventControllerScroll"
646 "(n_press, x, y) => {",
647 "\tGtk.TextIter iter;",
648 "\tint buffer_x, buffer_y;",
649 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
651 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
652 "\t\t(int)x - gut.get_width(), (int)y,",
653 " \t\tout buffer_x, out buffer_y);",
654 "\t_this.view.el.get_iter_at_location (out iter, ",
655 "\t\t\tbuffer_x, buffer_y);;",
658 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
659 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
663 "\tvar back = iter.copy();",
664 "\tback.backward_char();",
666 "\tvar forward = iter.copy();",
667 "\tforward.forward_char();",
669 "\t// what's the character at the iter?",
670 "\tvar str = back.get_text(iter);",
671 "\tstr += iter.get_text(forward);",
672 "\tif (str.strip().length < 1) {",
675 "\tvar offset = iter.get_line_offset();",
676 "\tvar line = iter.get_line();",
677 "\tif (_this.prop != null) {",
679 "\t\tline += _this.prop.start_line ; ",
680 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
681 "\t\toffset += _this.node.node_pad.length;",
682 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
683 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
684 "\t\t\toffset += 2;",
688 "\tvar ls = _this.file.getLanguageServer();",
690 "\t\t_this.file, line, offset,",
692 "\t\t\tvar res = ls.hover.end(o );",
693 "\t\t\t_this.helper.setHelp(res);",
697 "\t\t\tthings that can ber returned..",
698 "\t\t\t\"int\" (type only)",
700 "\t\t\tEditor xxxx._thisJ",
701 "\t\t\tJsrennder.jsrender Editor.file ",
702 "\t\t\tPalete.LanguageClient? JsRender.JsRender.getLanguageServer ()",
703 "\t\t\tPalete.LanguageClient? ls = _this.file.getLanguageServer()",
704 "\t\t\tasync Lsp.Hover Palete.LanguageClient.hover (JsRender.JsRender file, int line, int offset) throws GLib.Error",
705 "\t\t\t.string JsRender.Node.node_pad = \\\"\\\" ",
706 "\t\t\tGtk.TextIter iter",
708 "\t\t string Gtk.TextIter.get_text (Gtk.TextIter end)",
713 "\t\t // could never get this to work anywhere..",
714 "\t\t // looks like its probably for calling stuff..",
715 "\t\t // but always returns null..",
717 "\tls.signatureHelp.begin(",
718 "\t\t_this.file, iter.get_line(), iter.get_line_offset(),",
720 "\t\t\tvar res = ls.signatureHelp.end(o );",
729 "xtype" : "GestureClick"
734 "(x, y, keyboard_tooltip, tooltip) => {",
736 "\t//GLib.debug(\"query tooltip\");",
737 "\tGtk.TextIter iter;",
740 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
742 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
744 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
745 "\t//\treturn false;",
748 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
750 "\tvar l = iter.get_line();",
754 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
760 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
761 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
762 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
770 "\t// this crashes?? - not sure why.",
771 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
772 "\tif (marks.is_empty()) {",
773 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
775 "\tif (marks.is_empty()) {",
776 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
779 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
781 "\tmarks.@foreach((m) => { ",
782 "\t\t//GLib.debug(\"got mark %s\", m.name);",
783 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
785 "\t// true if there is a mark..",
786 "\tif (str.length > 0 ) {",
787 "\t\ttooltip.set_text( str );",
789 "\treturn str.length > 0 ? true : false;",
795 "string name" : "editor-view",
796 "uint tab_width" : 4,
801 "// show the help page for the active node..",
802 " //this.get('/Help').show();",
804 " // this.get('/BottomPane').el.set_current_page(0);",
805 " \tGLib.debug(\"load called - Reset undo buffer\");",
807 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
808 " buf.begin_irreversible_action();",
809 " buf.set_text(str, str.length);",
810 " buf.end_irreversible_action();",
812 " var lm = GtkSource.LanguageManager.get_default();",
813 " var lang = \"vala\";",
814 " if (_this.file != null) {",
815 " lang = _this.file.language;",
817 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
818 " var lg = _this.file.content_type.length > 0 ?",
819 " lm.guess_language(_this.file.path, _this.file.content_type) :",
820 " lm.get_language(lang);",
823 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
825 " this.el.insert_spaces_instead_of_tabs = true;",
826 " if (lg != null) {",
827 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
828 "\t\tif (lg.name == \"Vala\") {",
829 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
832 " _this.dirty = false;",
833 " this.el.grab_focus();",
834 " _this.save_button.el.sensitive = false;",
835 " _this.last_error_counter = -1;",
840 "xtype" : "ScrolledWindow"
845 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
846 "bool homogeneous" : false,
847 "bool vexpand" : false,
852 "Gtk.CssProvider css" : "",
853 "bool hexpand" : true,
854 "id" : "search_entry",
860 "(keyval, keycode, state) => {",
862 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
863 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
864 "\t\t_this.forwardSearch(true);",
869 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
870 "\t\t_this.forwardSearch(true);",
876 " // print(event.key.keyval)",
883 "xtype" : "EventControllerKey"
890 "_this.search(_this.search_entry.el.text);",
891 "\t _this.search_results.updateResults();",
893 "\tGLib.Timeout.add_seconds(1,() => {",
894 "\t\t _this.search_results.updateResults();",
895 "\t\t return false;",
901 "string name" : "editor-search-entry",
902 "string placeholder_text" : "Press enter to search",
903 "uint search_delay" : 3,
904 "xtype" : "SearchEntry",
905 "| void forwardSearch" : [
906 "(bool change_focus) {",
909 "\t_this.forwardSearch(change_focus);",
913 "\tswitch(_this.windowstate.state) {",
914 "\t\tcase WindowState.State.CODEONLY:",
915 "\t\t//case WindowState.State.CODE:",
916 "\t\t\t// search the code being edited..",
917 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
920 "\t\tcase WindowState.State.PREVIEW:",
921 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
922 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
924 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
937 "id" : "search_results",
938 "int margin_end" : 4,
939 "int margin_start" : 4,
940 "string label" : "No Results",
942 "| void updateResults" : [
944 "\tthis.el.visible = true;",
946 "\tvar res = _this.searchcontext.get_occurrences_count();",
948 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
952 "\t_this.nextBtn.el.sensitive = false;",
953 "\t_this.backBtn.el.sensitive = false;\t",
956 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
957 "\t\t_this.nextBtn.el.sensitive = true;",
958 "\t\t_this.backBtn.el.sensitive = true;",
961 "\t_this.search_results.el.label = \"No Matches\";",
968 "bool always_show_image" : true,
969 "bool sensitive" : false,
975 "\t_this.forwardSearch(true);",
982 "string icon_name" : "go-down",
987 "bool always_show_image" : true,
988 "bool sensitive" : false,
994 "\t_this.backSearch(true);",
1000 "string icon_name" : "go-up",
1005 "bool always_show_arrow" : true,
1006 "bool always_show_image" : true,
1010 "* prop" : "popover",
1011 "id" : "search_settings",
1016 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1023 "\tthis.el.show();",
1027 "id" : "case_sensitive",
1028 "string label" : "Case Sensitive",
1029 "xtype" : "CheckButton"
1035 "\tthis.el.show();",
1040 "string label" : "Regex",
1041 "xtype" : "CheckButton"
1046 "string label" : "Multi-line (add \\n)",
1047 "xtype" : "CheckButton"
1056 "string icon_name" : "emblem-system",
1057 "xtype" : "MenuButton"
1067 "* prop" : "end_child",
1068 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1069 "bool hexpand" : true,
1070 "bool vexpand" : true,
1075 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1081 "bool hexpand" : true,
1082 "bool vexpand" : true,
1083 "bool visible" : false,
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) {",
1467 "\t_this.navigationwindow.el.show();",
1468 "\t//_this.navliststore.el.remove_all();",
1471 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1473 "\tforeach(var sym in syms) {",
1474 "\t\tls.append(sym);",
1476 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1477 "\t//_this.navliststore.el.append(sym);",
1478 "\tthis.last_selected_line = -1;",
1479 "\tGLib.Idle.add(() => {",
1480 "\t\t_this.navigationsort.collapseOnLoad();",
1481 "\t\tGtk.TextIter iter;",
1482 "\t\t_this.buffer.el.get_iter_at_offset (",
1483 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1485 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1486 "\t\t\t\titer.get_line_offset());",
1487 "\t\tthis.updateSelectedLine(",
1488 "\t\t\t\t(uint)iter.get_line(),",
1489 "\t\t\t\t(uint)iter.get_line_offset()",
1491 "\t\treturn false;",
1496 "| void updateSelectedLine" : [
1497 "(uint line, uint chr) {",
1498 "\tif (line == this.last_selected_line) {",
1501 "\tGLib.debug(\"select line %d\", (int)line);",
1502 "\tthis.last_selected_line = (int)line;",
1505 "\tvar new_row = -1;",
1506 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1507 "\tif (sym != null) {",
1508 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1509 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1511 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1514 "\tif (this.selected_row != null) { ",
1515 "\t\tGLib.debug(\" remove selected row\");",
1516 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1518 "\tthis.selected_row = null;",
1519 "\tif (new_row > -1) {",
1520 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1521 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1522 "\t\tif (row != null) {",
1523 "\t\t\tGLib.debug(\" Add selected row\");",
1525 "\t\t\trow.add_css_class(\"selected-row\");",
1526 "\t\t\tthis.selected_row = row;",
1530 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1540 "xtype" : "ScrolledWindow"
1550 "| bool saveContents" : [
1554 " if (_this.file == null) {",
1560 " var str = _this.buffer.toString();",
1562 " _this.buffer.checkSyntax();",
1566 " // LeftPanel.model.changed( str , false);",
1567 " _this.dirty = false;",
1568 " _this.save_button.el.sensitive = false;",
1570 " // find the text for the node..",
1571 " if (_this.file.xtype != \"PlainFile\") {",
1572 " // in theory these properties have to exist!?!",
1573 " \tthis.prop.val = str;",
1574 " //this.window.windowstate.left_props.reload();",
1576 " _this.file.setSource( str );",
1579 " // call the signal..",
1587 "(string in_txt) {",
1589 "\tvar s = new GtkSource.SearchSettings();",
1590 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1591 "\ts.regex_enabled = _this.regex.el.active;\t",
1592 "\ts.wrap_around = false;",
1594 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1595 "\tthis.searchcontext.set_highlight(true);",
1596 "\tvar txt = in_txt;",
1598 "\tif (_this.multiline.el.active) {",
1599 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1602 "\ts.set_search_text(txt);",
1603 "\tGtk.TextIter beg, st,en;",
1605 "\tthis.buffer.el.get_start_iter(out beg);",
1606 "\tbool has_wrapped_around;",
1607 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1608 "\tthis.last_search_end = 0;",
1610 "\treturn this.searchcontext.get_occurrences_count();",
1618 "| string tempFileContents" : [
1622 " if (_this.file == null) {",
1625 "\tvar str= this.buffer.toString();",
1626 "\tif (_this.file.xtype == \"PlainFile\") {",
1634 " GLib.debug(\"calling validate\"); ",
1635 " // clear the buttons.",
1636 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1637 "\t\treturn this.file.toSource(); ;",
1640 "\tvar oldcode = _this.prop.val;",
1641 "\t_this.prop.val = str;",
1642 " var ret = _this.file.toSource();",
1643 " _this.prop.val = oldcode;",
1648 "| void backSearch" : [
1649 "(bool change_focus) {",
1651 "\tif (this.searchcontext == null) {",
1655 "\tGtk.TextIter beg, st,en;",
1656 "\tbool has_wrapped_around;",
1657 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1659 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1660 "\t\tthis.last_search_end = 0;",
1662 "\t\tthis.last_search_end = en.get_offset();",
1663 "\t\tif (change_focus) {",
1664 "\t\t\tthis.view.el.grab_focus();",
1666 "\t\tthis.buffer.el.place_cursor(st);",
1667 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1673 "| void forwardSearch" : [
1674 "(bool change_focus) {",
1676 "\tif (this.searchcontext == null) {",
1680 "\tGtk.TextIter beg, st,en;",
1681 "\t bool has_wrapped_around;",
1682 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1683 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1685 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1687 "\t\tif (has_wrapped_around) {",
1691 "\t\tthis.last_search_end = en.get_offset();",
1692 "\t\tif (change_focus) {",
1693 "\t\t\tthis.view.el.grab_focus();",
1695 "\t\tthis.buffer.el.place_cursor(st);",
1696 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1704 "\t this.file = null; ",
1706 " this.node = null;",
1707 " this.prop = null;",
1708 "\tthis.searchcontext = null;",
1713 "| void scroll_to_line" : [
1716 "\tGLib.Timeout.add(500, () => {",
1718 "\t\tvar buf = this.view.el.get_buffer();",
1720 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1723 "\t\tGtk.TextIter iter; ",
1724 "\t\tsbuf.get_iter_at_line(out iter, line);",
1725 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1726 "\t\treturn false;",
1732 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1735 " if (this.file != null) {",
1736 " \tthis.file.navigation_tree_updated.disconnect(",
1737 " \t\t_this.navigation.show",
1740 " this.file = file; ",
1741 " this.file.navigation_tree_updated.connect(",
1742 "\t\t_this.navigation.show",
1744 " if (file.xtype != \"PlainFile\") {",
1745 " \tthis.prop = prop;",
1746 " this.node = node;",
1748 " // find the text for the node..",
1749 " this.view.load( prop.val );",
1750 " this.updateErrorMarks();",
1754 " this.close_btn.el.show(); ",
1757 " this.view.load( file.toSource() );",
1758 " this.updateErrorMarks();",
1759 " this.close_btn.el.hide();",
1760 " var ls = file.getLanguageServer();",
1761 " ls.queueDocumentSymbols(file);",
1762 " ////ls.documentSymbols.begin(file, (a,o) => {",
1763 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1765 " //documentSymbols",
1771 "| void updateErrorMarks" : [
1776 "\tvar buf = _this.buffer.el;",
1777 "\tGtk.TextIter start;",
1778 "\tGtk.TextIter end; ",
1779 "\tbuf.get_bounds (out start, out end);",
1784 "\t//GLib.debug(\"highlight errors\");\t\t ",
1786 "\t // we should highlight other types of errors..",
1788 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1790 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1792 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1798 "\tif (_this.file == null) {",
1799 "\t\tGLib.debug(\"file is null?\");",
1803 "\tvar ar = this.file.getErrors();",
1804 "\tif (ar.size < 1) {",
1805 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1806 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1807 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1808 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1809 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1810 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1811 "\t\tthis.last_error_counter = file.error_counter ;",
1812 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1817 " // basicaly check if there is no change, then we do not do any update..",
1818 " // we can do this by just using an error counter?",
1819 " // if that's changed then we will do an update, otherwise dont bother.",
1822 "\tvar offset = 0;",
1823 "\tvar hoffset = 0;",
1825 "\tvar tlines = buf.get_line_count () +1;",
1827 "\tif (_this.prop != null) {",
1828 "\t\t// this still seems flaky...",
1830 "\t\ttlines = _this.prop.end_line;",
1831 "\t\toffset = _this.prop.start_line;",
1832 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1836 "\t\t// no update...",
1837 "\t\tif (this.last_error_counter == file.error_counter) {",
1843 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1844 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1845 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1846 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1847 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1848 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1850 "\tforeach(var diag in ar) { ",
1851 "\t Gtk.TextIter iter;",
1852 "// print(\"get inter\\n\");",
1853 "\t var eline = (int)diag.range.start.line - offset;",
1854 "\t var eline_to = (int)diag.range.end.line - offset;",
1855 "\t //var eline = diag.range.end_line - offset;",
1856 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1857 "\t //\terr.line ,eline, offset);",
1860 "\t if (eline > tlines || eline < 0) {",
1864 "\t buf.get_iter_at_line( out iter, eline);",
1865 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1866 "\t buf.create_source_mark( msg, diag.category, iter);",
1868 " \t var spos = (int)diag.range.start.character - hoffset;",
1869 " \t if (spos < 0) { spos =0 ; }",
1870 " \t if (spos > iter.get_chars_in_line()) {",
1871 " \t \tspos = iter.get_chars_in_line();",
1873 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1874 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1875 " \t if (epos < 0) { epos =0 ; }",
1876 " \t if (epos > iter.get_chars_in_line()) {",
1877 " \t \tepos = iter.get_chars_in_line();",
1881 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1883 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1885 "\t buf.apply_tag_by_name(diag.category, start, end);",
1887 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1888 "\t //this.marks.set(eline, msg);",
1890 "\tthis.last_error_counter = file.error_counter ;",