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,
35 "* prop" : "start_child",
36 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
37 "bool hexpand" : true,
41 "$ homogeneous" : false,
43 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
44 "bool hexpand" : false,
45 "bool vexpand" : false,
49 "bool vexpand" : true,
55 " _this.saveContents();",
64 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
65 "bool hexpand" : true,
69 "int margin_start" : 4,
72 "(Lsp.Hover? help) {",
73 "\tif (help == null || help.contents == null",
74 "\t\t|| help.contents.size < 1) {",
75 "\t\tthis.el.set_text(\"\");",
78 "\tvar sig = help.contents.get(0).value.split(\" \");",
79 "\tstring[] str = {};",
80 "\tfor(var i =0; i < sig.length; i++) {",
82 "\t\tswitch(sig[i]) {",
83 "\t\t\tcase \"public\":",
84 "\t\t\tcase \"private\":",
85 "\t\t\tcase \"protected\":",
86 "\t\t\tcase \"async\":",
87 "\t\t\tcase \"class\":",
93 "\t\t\t\tstr += sig[i];",
99 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
100 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
101 "\t\t\t\t\t+\"</span>\");",
105 "\tif (help.contents.size > 1) {",
106 "\t\tsig += (\"\\n\\n\" + help.contents[1].value);",
109 "\tthis.el.set_markup(string.joinv(\" \",str));",
116 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
119 "\t//this.el.set_range(6,30);",
120 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
121 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
123 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
124 " \t\t//\tGLib.debug(\"update range\");",
125 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
126 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
134 "Gtk.Align halign" : "Gtk.Align.END",
135 "bool draw_value" : false,
136 "bool has_origin" : true,
137 "bool sensitive" : true,
139 "int width_request" : 150,
143 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
146 " \tBuilderApplication.settings.editor_font_size = val;",
155 "Gtk.Align halign" : "Gtk.Align.END",
161 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
162 "string icon_name" : "window-close",
169 " _this.saveContents();",
170 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
175 "string icon_name" : "window-close",
183 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
184 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
185 "bool overlay_scrolling" : false,
186 "bool vexpand" : true,
187 "id" : "RightEditor",
190 "# Gtk.CssProvider css" : "null",
191 "$ gboolean auto_indent" : true,
192 "$ xns" : "GtkSource",
199 "this.el.completion.add_provider(",
200 "\tnew Palete.CompletionProvider(_this)",
203 "// hover seems pretty useless.. - ??",
204 "//var hover = this.el.get_hover();",
205 "//hover.add_provider(new Palete.HoverProvider(_this));",
207 "//this.el.completion.unblock_interactive();",
208 "this.el.completion.select_on_show = true; // select",
209 "//this.el.completion.remember_info_visibility\t = true;",
212 "var attrs = new GtkSource.MarkAttributes();",
214 "attrs.set_icon_name ( \"process-stop\"); ",
215 "attrs.query_tooltip_text.connect(( mark) => {",
216 " GLib.debug(\"tooltip query? %s\", mark.name);",
217 " return strdup( mark.name);",
219 " attrs.query_tooltip_markup.connect(( mark) => {",
220 " GLib.debug(\"tooltip query? %s\", mark.name);",
221 " return strdup( mark.name);",
223 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
227 "var wattrs = new GtkSource.MarkAttributes();",
228 "wattrs.set_icon_name ( \"process-stop\"); ",
229 "wattrs.query_tooltip_text.connect(( mark) => {",
230 " GLib.debug(\"tooltip query? %s\", mark.name);",
231 " return strdup(mark.name);",
233 "wattrs.query_tooltip_markup.connect(( mark) => {",
234 " GLib.debug(\"tooltip query? %s\", mark.name);",
235 " return strdup(mark.name);",
237 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
241 "var dattrs = new GtkSource.MarkAttributes();",
243 "dattrs.set_icon_name ( \"process-stop\"); ",
245 "dattrs.query_tooltip_text.connect(( mark) => {",
246 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
247 " return strdup(mark.name);",
249 "//dattrs.query_tooltip_markup.connect(( mark) => {",
250 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
251 " // return strdup(mark.name);",
253 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
256 " this.el.get_space_drawer().set_matrix(null);",
257 " this.el.get_space_drawer().set_types_for_locations( ",
258 "\tGtkSource.SpaceLocationFlags.ALL,",
259 "\tGtkSource.SpaceTypeFlags.ALL",
261 "this.el.get_space_drawer().set_enable_matrix(true);",
265 "bool has_tooltip" : true,
266 "bool hexpand" : true,
267 "bool insert_spaces_instead_of_tabs" : true,
268 "bool vexpand" : true,
269 "boolean show_line_marks" : true,
270 "boolean show_line_numbers" : true,
271 "css_classes" : "{ \"code-editor\" }",
272 "gboolean highlight_current_line" : true,
277 "$ Gee.HashMap<int,string>? xmarks" : "null",
278 "$ xns" : "GtkSource",
279 "$ xtype" : "Buffer",
282 "var buf = this.el;",
283 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
284 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
285 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
286 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
287 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
288 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
289 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
290 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
293 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
294 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
295 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
301 "bool check_queued" : false,
302 "bool enable_undo" : true,
303 "bool highlight_matching_brackets" : true,
304 "bool highlight_syntax" : true,
306 "int error_line" : "-1",
310 " // check syntax??",
312 " _this.save_button.el.sensitive = true;",
313 " print(\"EDITOR CHANGED\");",
314 " this.checkSyntax();",
316 " _this.dirty = true;",
318 " // this.get('/LeftPanel.model').changed( str , false);",
326 "\tGtk.TextIter iter;",
327 "\tthis.el.get_iter_at_offset (",
328 "\t\t\tout iter, this.el.cursor_position);",
330 "\t_this.navigation.updateSelectedLine(",
331 "\t\t\t(uint)iter.get_line(),",
332 "\t\t\t(uint)iter.get_line_offset()",
334 "\tthis.showHelp(iter);",
340 "| bool OLDhighlightErrorsJson" : [
341 "(string type, Json.Object obj) {",
342 "\tGtk.TextIter start;",
343 "\tGtk.TextIter end; ",
344 "\tthis.el.get_bounds (out start, out end);",
346 "\tthis.el.remove_source_marks (start, end, type);",
347 "\tGLib.debug(\"highlight errors\");\t\t ",
349 "\t // we should highlight other types of errors..",
351 "\tif (!obj.has_member(type)) {",
352 "\t\tGLib.debug(\"Return has no errors\\n\");",
356 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
358 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
360 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
365 "\t//this.marks = new Gee.HashMap<int,string>();",
366 "\tvar err = obj.get_object_member(type);",
368 "\tif (_this.file == null) {",
369 "\t\tGLib.debug(\"file is null?\");",
373 "\tvar valafn = _this.file.path;",
375 "\tif (_this.file.xtype != \"PlainFile\") {",
377 "\t\tvalafn = \"\";",
379 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
380 "\t\t\t// should not happen",
381 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
382 "\t\t} catch (GLib.RegexError e) {",
383 "\t\t\treturn true;",
389 "\tif (!err.has_member(valafn)) {",
390 "\t\tGLib.debug(\"File path has no errors\");",
394 "\tvar lines = err.get_object_member(valafn);",
397 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
398 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
402 "\tvar tlines = this.el.get_line_count () +1;",
404 "\tif (_this.prop != null) {",
406 "\t\ttlines = _this.prop.end_line + 1;",
407 "\t\toffset = _this.prop.start_line + 1;",
413 "\tlines.foreach_member((obj, line, node) => {",
415 "\t Gtk.TextIter iter;",
416 "// print(\"get inter\\n\");",
417 "\t var eline = int.parse(line) - offset;",
418 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
421 "\t if (eline > tlines || eline < 0) {",
426 "\t this.el.get_iter_at_line( out iter, eline);",
427 "\t //print(\"mark line\\n\");",
428 "\t var msg = \"\";",
429 "\t var ar = lines.get_array_member(line);",
430 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
431 "\t \tif (ar.get_string_element(i) == \"Success\") {",
434 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
435 "\t\t\tmsg += ar.get_string_element(i);",
437 "\t\tif (msg == \"\") {",
440 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
441 "\t this.el.create_source_mark(msg, type, iter);",
442 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
443 "\t // this.marks.set(eline, msg);",
454 "| bool checkSyntax" : [
458 " var str = this.toString();",
461 " if (this.error_line > 0) {",
462 " Gtk.TextIter start;",
463 " Gtk.TextIter end; ",
464 " this.el.get_bounds (out start, out end);",
466 " this.el.remove_source_marks (start, end, null);",
468 " if (str.length < 1) {",
469 " print(\"checkSyntax - empty string?\\n\");",
473 " // bit presumptiona",
474 " if (_this.file.xtype == \"PlainFile\") {",
476 " // assume it's gtk...",
477 " var oldcode =_this.file.toSource();",
478 " _this.file.setSource(str);",
479 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
480 " \t_this.file.getLanguageServer().document_change(_this.file);",
481 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
482 " _this.file.setSource(oldcode);",
488 " if (_this.file == null) {",
496 " GLib.debug(\"calling validate\"); ",
497 " // clear the buttons.",
498 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
501 "\tvar oldcode = _this.prop.val;",
503 "\t_this.prop.val = str;",
504 "\t_this.node.updated_count++;",
505 " _this.file.getLanguageServer().document_change(_this.file);",
506 " _this.node.updated_count++;",
507 " _this.prop.val = oldcode;",
510 " //print(\"done mark line\\n\");",
512 " return true; // at present allow saving - even if it's invalid..",
516 "| bool highlightErrors" : [
517 "( Gee.HashMap<int,string> validate_res) {",
519 "\tthis.error_line = validate_res.size;",
521 "\tif (this.error_line < 1) {",
524 "\tvar tlines = this.el.get_line_count ();",
525 "\tGtk.TextIter iter;",
526 "\tvar valiter = validate_res.map_iterator();",
527 "\twhile (valiter.next()) {",
529 "\t// print(\"get inter\\n\");",
530 "\t\tvar eline = valiter.get_key();",
531 "\t\tif (eline > tlines) {",
534 "\t\tthis.el.get_iter_at_line( out iter, eline);",
535 "\t\t//print(\"mark line\\n\");",
536 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
541 "| string toString" : [
546 " this.el.get_start_iter(out s);",
547 " this.el.get_end_iter(out e);",
548 " var ret = this.el.get_text(s,e,true);",
549 " //print(\"TO STRING? \" + ret);",
554 "| void showHelp" : [
555 "(Gtk.TextIter iter) {",
556 "\tvar back = iter.copy();",
557 "\tback.backward_char();",
559 "\tvar forward = iter.copy();",
560 "\tforward.forward_char();",
562 "\t// what's the character at the iter?",
563 "\tvar str = back.get_text(iter);",
564 "\tstr += iter.get_text(forward);",
565 "\tif (str.strip().length < 1) {",
568 "\tvar offset = iter.get_line_offset();",
569 "\tvar line = iter.get_line();",
570 "\tif (_this.prop != null) {",
572 "\t\tline += _this.prop.start_line ; ",
573 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
574 "\t\toffset += _this.node.node_pad.length;",
575 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
576 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
577 "\t\t\toffset += 2;",
581 "\tvar ls = _this.file.getLanguageServer();",
583 "\t\t_this.file, line, offset,",
586 "\t\t\t\tvar res = ls.hover.end(o );",
588 "\t\t\t\t_this.helper.setHelp(res);",
589 "\t\t\t} catch (GLib.Error e) {",
599 "# bool is_control" : false,
604 "(keyval, keycode, state) => {",
606 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
607 " \t\tthis.is_control = true;",
614 "(keyval, keycode, state) => {",
616 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
617 " \t\tthis.is_control = false;",
619 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
620 " GLib.debug(\"SAVE: ctrl-S pressed\");",
621 " _this.saveContents();",
625 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
626 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
627 "\t\t_this.forwardSearch(true);",
630 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
631 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
632 "\t\t_this.search_entry.el.grab_focus();",
633 "\t\t_this.search_entry.el.select_region(0,-1);",
636 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
637 "\t\t_this.view.el.show_completion();",
640 "\tGtk.TextIter iter;",
641 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
642 "\tvar line = iter.get_line();",
643 "\tvar offset = iter.get_line_offset();",
644 "\tGLib.debug(\"line %d off %d\", line ,offset);",
645 "\tif (_this.prop != null) {",
646 "\t\tline += _this.prop.start_line + 1; // i think..",
647 "\t\toffset += 12; // should probably be 8 without namespaced ",
648 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
650 " //_this.view.el.show_completion();",
651 " // print(event.key.keyval)",
661 "xtype" : "EventControllerKey"
664 "# double distance" : "0.0f",
666 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
670 "\tif (!_this.keystate.is_control) {",
673 "\t //GLib.debug(\"scroll %f\", dy);",
675 "\tthis.distance += dy;",
677 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
679 "\t if (this.distance < -1) {",
681 "\t\tBuilderApplication.settings.editor_font_size ++;",
682 "\t\tthis.distance = 0;",
684 "\tif (this.distance > 1) {",
685 "\t\tBuilderApplication.settings.editor_font_size --;",
686 "\t\tthis.distance = 0;",
694 "xtype" : "EventControllerScroll"
700 "(n_press, x, y) => {",
701 "\tGtk.TextIter iter;",
702 "\tint buffer_x, buffer_y;",
703 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
705 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
706 "\t\t(int)x - gut.get_width(), (int)y,",
707 " \t\tout buffer_x, out buffer_y);",
708 "\t_this.view.el.get_iter_at_location (out iter, ",
709 "\t\t\tbuffer_x, buffer_y);;",
712 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
713 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
717 "\t_this.buffer.showHelp(iter);",
725 "xtype" : "GestureClick"
730 "(x, y, keyboard_tooltip, tooltip) => {",
732 "\t//GLib.debug(\"query tooltip\");",
733 "\tGtk.TextIter iter;",
736 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
738 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
740 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
741 "\t//\treturn false;",
744 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
746 "\tvar l = iter.get_line();",
750 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
756 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
757 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
758 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
766 "\t// this crashes?? - not sure why.",
767 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
768 "\tif (marks.is_empty()) {",
769 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
771 "\tif (marks.is_empty()) {",
772 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
775 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
777 "\tmarks.@foreach((m) => { ",
778 "\t\t//GLib.debug(\"got mark %s\", m.name);",
779 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
781 "\t// true if there is a mark..",
782 "\tif (str.length > 0 ) {",
783 "\t\ttooltip.set_text( str );",
785 "\treturn str.length > 0 ? true : false;",
791 "string name" : "editor-view",
792 "uint tab_width" : 4,
797 "// show the help page for the active node..",
798 " //this.get('/Help').show();",
800 " // this.get('/BottomPane').el.set_current_page(0);",
801 " \tGLib.debug(\"load called - Reset undo buffer\");",
803 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
804 " buf.begin_irreversible_action();",
805 " buf.set_text(str, str.length);",
806 " buf.end_irreversible_action();",
808 " var lm = GtkSource.LanguageManager.get_default();",
809 " var lang = \"vala\";",
810 " if (_this.file != null) {",
811 " lang = _this.file.language;",
813 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
814 " var lg = _this.file.content_type.length > 0 ?",
815 " lm.guess_language(_this.file.path, _this.file.content_type) :",
816 " lm.get_language(lang);",
819 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
821 " this.el.insert_spaces_instead_of_tabs = true;",
822 " if (lg != null) {",
823 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
824 "\t\tif (lg.name == \"Vala\") {",
825 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
828 " _this.dirty = false;",
829 " this.el.grab_focus();",
830 " _this.save_button.el.sensitive = false;",
831 " _this.last_error_counter = -1;",
836 "xtype" : "ScrolledWindow"
841 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
842 "bool homogeneous" : false,
843 "bool vexpand" : false,
848 "Gtk.CssProvider css" : "",
849 "bool hexpand" : true,
850 "id" : "search_entry",
856 "(keyval, keycode, state) => {",
858 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
859 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
860 "\t\t_this.forwardSearch(true);",
865 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
866 "\t\t_this.forwardSearch(true);",
872 " // print(event.key.keyval)",
879 "xtype" : "EventControllerKey"
886 "_this.search(_this.search_entry.el.text);",
887 "\t _this.search_results.updateResults();",
889 "\tGLib.Timeout.add_seconds(1,() => {",
890 "\t\t _this.search_results.updateResults();",
891 "\t\t return false;",
897 "string name" : "editor-search-entry",
898 "string placeholder_text" : "Press enter to search",
899 "uint search_delay" : 3,
900 "xtype" : "SearchEntry",
901 "| void forwardSearch" : [
902 "(bool change_focus) {",
905 "\t_this.forwardSearch(change_focus);",
909 "\tswitch(_this.windowstate.state) {",
910 "\t\tcase WindowState.State.CODEONLY:",
911 "\t\t//case WindowState.State.CODE:",
912 "\t\t\t// search the code being edited..",
913 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
916 "\t\tcase WindowState.State.PREVIEW:",
917 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
918 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
920 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
933 "id" : "search_results",
934 "int margin_end" : 4,
935 "int margin_start" : 4,
936 "string label" : "No Results",
938 "| void updateResults" : [
940 "\tthis.el.visible = true;",
942 "\tvar res = _this.searchcontext.get_occurrences_count();",
944 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
948 "\t_this.nextBtn.el.sensitive = false;",
949 "\t_this.backBtn.el.sensitive = false;\t",
952 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
953 "\t\t_this.nextBtn.el.sensitive = true;",
954 "\t\t_this.backBtn.el.sensitive = true;",
957 "\t_this.search_results.el.label = \"No Matches\";",
964 "bool always_show_image" : true,
965 "bool sensitive" : false,
971 "\t_this.forwardSearch(true);",
978 "string icon_name" : "go-down",
983 "bool always_show_image" : true,
984 "bool sensitive" : false,
990 "\t_this.backSearch(true);",
996 "string icon_name" : "go-up",
1001 "bool always_show_arrow" : true,
1002 "bool always_show_image" : true,
1006 "* prop" : "popover",
1007 "id" : "search_settings",
1012 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1019 "\tthis.el.show();",
1023 "id" : "case_sensitive",
1024 "string label" : "Case Sensitive",
1025 "xtype" : "CheckButton"
1031 "\tthis.el.show();",
1036 "string label" : "Regex",
1037 "xtype" : "CheckButton"
1042 "string label" : "Multi-line (add \\n)",
1043 "xtype" : "CheckButton"
1052 "string icon_name" : "emblem-system",
1053 "xtype" : "MenuButton"
1063 "* prop" : "end_child",
1064 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1065 "bool hexpand" : true,
1066 "bool vexpand" : true,
1067 "bool visible" : false,
1068 "id" : "navigation_holder",
1070 "int width_request" : 120,
1074 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1080 "bool hexpand" : true,
1081 "bool vexpand" : true,
1082 "bool visible" : true,
1083 "id" : "navigationwindow",
1086 "# int last_selected_line" : "-1",
1087 "$ Gtk.Widget? selected_row" : "null",
1090 "id" : "navigation",
1094 "bool expand" : true,
1098 "* prop" : "factory",
1103 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1105 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1106 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1109 "\tvar hbox = (Gtk.Box) expand.child;",
1112 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1113 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1115 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1116 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1118 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1119 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1121 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1123 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1125 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1126 " \texpand.set_list_row(lr);",
1127 " \t//this.in_bind = true;",
1128 " \t// default is to expand",
1130 " \t//this.in_bind = false;",
1132 " \tsym.bind_property(\"symbol_icon\",",
1133 " img, \"icon_name\",",
1134 " GLib.BindingFlags.SYNC_CREATE);",
1136 " \thbox.css_classes = { sym.symbol_icon };",
1138 " \tsym.bind_property(\"name\",",
1140 " GLib.BindingFlags.SYNC_CREATE);",
1141 " \t// should be better?- --line no?",
1142 " \tsym.bind_property(\"tooltip\",",
1143 " lbl, \"tooltip_markup\",",
1144 " GLib.BindingFlags.SYNC_CREATE);",
1145 " \t// bind image...",
1153 "\tvar expand = new Gtk.TreeExpander();",
1155 "\texpand.set_indent_for_depth(true);",
1156 "\texpand.set_indent_for_icon(true);",
1157 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1158 "\tvar icon = new Gtk.Image();",
1159 "\tvar lbl = new Gtk.Label(\"\");",
1160 "\tlbl.use_markup = true;",
1161 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1163 "\ticon.margin_end = 4;",
1164 " \tlbl.justify = Gtk.Justification.LEFT;",
1165 " \tlbl.xalign = 0;",
1167 "//\tlistitem.activatable = true; ??",
1169 "\thbox.append(icon);",
1170 "\thbox.append(lbl);",
1171 "\texpand.set_child(hbox);",
1172 "\t((Gtk.ListItem)listitem).set_child(expand);",
1178 "xtype" : "SignalListItemFactory"
1181 "string title" : "Code Navigation",
1182 "xtype" : "ColumnViewColumn"
1187 "id" : "navigationselmodel",
1192 "id" : "navigationsort",
1195 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1198 "\treturn ((Lsp.DocumentSymbol)item).children;",
1204 "bool autoexpand" : true,
1205 "bool passthrough" : false,
1208 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1211 "id" : "navliststore",
1212 "xtype" : "ListStore",
1213 "| Lsp.DocumentSymbol? symbolAtLine" : [
1214 "(uint line, uint chr) {",
1217 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1218 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1219 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1220 "\t\t//\tel.name , (int)el.range.start.line,",
1221 "\t\t//\t(int)el.range.end.line",
1223 "\t\tvar ret = el.containsLine(line,chr);",
1224 "\t\tif (ret != null) {",
1225 "\t\t\treturn ret;",
1237 "(position, removed, added) => {",
1238 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1239 "\t if (added < 1) { ",
1242 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1243 "\tvar row = this.el.get_row(position);",
1245 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1252 "xtype" : "TreeListModel"
1256 "* prop" : "sorter",
1260 "* prop" : "sorter",
1263 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1265 "* prop" : "expression",
1266 "string property_name" : "sort_key",
1267 "xtype" : "PropertyExpression"
1270 "xtype" : "StringSorter"
1273 "xtype" : "TreeListRowSorter"
1276 "xtype" : "SortListModel",
1277 "| Lsp.DocumentSymbol? getSymbolAt" : [
1280 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1282 " var a = tr.get_item();; ",
1283 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1286 " return (Lsp.DocumentSymbol)tr.get_item();",
1290 "| int getRowFromSymbol" : [
1291 "(Lsp.DocumentSymbol sym) {",
1293 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1294 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1296 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1303 "| void collapseOnLoad" : [
1305 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1306 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1307 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1308 "\t\tswitch (sym.kind) {",
1309 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1310 "\t \t\t\ttr.expanded = false;",
1313 "\t\t\t\t//tr.expanded = true;",
1325 "xtype" : "NoSelection"
1331 "(n_press, x, y) => {",
1333 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1335 " if (row == null) {",
1336 "\t GLib.debug(\"no row selected items\");",
1339 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1340 " //Lsp.DocumentSymbol",
1341 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1342 " if (sym == null) {",
1348 " \"line\" : 1410,",
1349 " \"character\" : 8",
1352 " \"line\" : 1410,",
1353 " \"character\" : 39",
1357 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1358 " _this.scroll_to_line((int)sym.range.start.line);",
1359 " Gtk.TextIter iter;",
1360 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1361 " \t(int)sym.range.start.line,",
1362 " \t(int)sym.range.start.character",
1364 " _this.buffer.el.place_cursor(iter);",
1369 "xtype" : "GestureClick"
1372 "string name" : "editor-navigation",
1373 "xtype" : "ColumnView",
1374 "| Gtk.Widget? getRowWidgetAt" : [
1375 "(double x, double y, out string pos) {",
1378 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1379 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1380 "\tif (w == null) {",
1384 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1385 "\tif (row == null) {",
1389 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1393 "\t//GLib.debug(\"row number is %d\", rn);",
1394 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1395 "\t// above or belw",
1396 "\tGraphene.Rect bounds;",
1397 "\trow.compute_bounds(this.el, out bounds);",
1398 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1399 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1400 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1402 "\tvar ypos = y - bounds.get_y();",
1403 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1404 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1405 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1406 "\tpos = \"over\";",
1408 "\tif (rpos > 80) {",
1409 "\t\tpos = \"below\";",
1410 "\t} else if (rpos < 20) {",
1411 "\t\tpos = \"above\";",
1416 "| int getRowAt" : [
1417 "(double x, double y, out string pos) {",
1420 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1421 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1422 "\tif (w == null) {",
1426 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1427 "\tif (row == null) {",
1431 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1436 "\twhile (cr.get_prev_sibling() != null) {",
1438 "\t\tcr = cr.get_prev_sibling();",
1441 "\t//GLib.debug(\"row number is %d\", rn);",
1442 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1443 "\t// above or belw",
1444 "\tGraphene.Rect bounds;",
1445 "\trow.compute_bounds(this.el, out bounds);",
1446 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1447 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1448 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1450 "\tvar ypos = y - bounds.get_y();",
1451 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1452 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1453 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1454 "\tpos = \"over\";",
1456 "\tif (rpos > 80) {",
1457 "\t\tpos = \"below\";",
1458 "\t} else if (rpos < 20) {",
1459 "\t\tpos = \"above\";",
1465 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1466 "\t_this.navigation_holder.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 ;",