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,
43 "bool vexpand" : true,
49 " _this.saveContents();",
58 "bool hexpand" : true,
61 "int margin_start" : 4,
66 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
69 "\t//this.el.set_range(6,30);",
70 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
71 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
73 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
74 " \t\t//\tGLib.debug(\"update range\");",
75 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
76 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
84 "bool draw_value" : false,
85 "bool has_origin" : true,
86 "bool sensitive" : true,
88 "int width_request" : 200,
92 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
95 " \tBuilderApplication.settings.editor_font_size = val;",
109 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
110 "string icon_name" : "window-close",
117 " _this.saveContents();",
118 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
123 "string icon_name" : "window-close",
131 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
132 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
133 "bool overlay_scrolling" : false,
134 "bool vexpand" : true,
135 "id" : "RightEditor",
138 "# Gtk.CssProvider css" : "null",
139 "$ gboolean auto_indent" : true,
140 "$ xns" : "GtkSource",
147 "this.el.completion.add_provider(",
148 "\tnew Palete.CompletionProvider(_this)",
151 "// hover seems pretty useless.. - ??",
152 "//var hover = this.el.get_hover();",
153 "//hover.add_provider(new Palete.HoverProvider(_this));",
155 "//this.el.completion.unblock_interactive();",
156 "this.el.completion.select_on_show = true; // select",
157 "//this.el.completion.remember_info_visibility\t = true;",
160 "var attrs = new GtkSource.MarkAttributes();",
162 "attrs.set_icon_name ( \"process-stop\"); ",
163 "attrs.query_tooltip_text.connect(( mark) => {",
164 " GLib.debug(\"tooltip query? %s\", mark.name);",
165 " return strdup( mark.name);",
167 " attrs.query_tooltip_markup.connect(( mark) => {",
168 " GLib.debug(\"tooltip query? %s\", mark.name);",
169 " return strdup( mark.name);",
171 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
175 "var wattrs = new GtkSource.MarkAttributes();",
176 "wattrs.set_icon_name ( \"process-stop\"); ",
177 "wattrs.query_tooltip_text.connect(( mark) => {",
178 " GLib.debug(\"tooltip query? %s\", mark.name);",
179 " return strdup(mark.name);",
181 "wattrs.query_tooltip_markup.connect(( mark) => {",
182 " GLib.debug(\"tooltip query? %s\", mark.name);",
183 " return strdup(mark.name);",
185 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
189 "var dattrs = new GtkSource.MarkAttributes();",
191 "dattrs.set_icon_name ( \"process-stop\"); ",
193 "dattrs.query_tooltip_text.connect(( mark) => {",
194 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
195 " return strdup(mark.name);",
197 "//dattrs.query_tooltip_markup.connect(( mark) => {",
198 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
199 " // return strdup(mark.name);",
201 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
204 " this.el.get_space_drawer().set_matrix(null);",
205 " this.el.get_space_drawer().set_types_for_locations( ",
206 "\tGtkSource.SpaceLocationFlags.ALL,",
207 "\tGtkSource.SpaceTypeFlags.ALL",
209 "this.el.get_space_drawer().set_enable_matrix(true);",
213 "bool has_tooltip" : true,
214 "bool hexpand" : true,
215 "bool insert_spaces_instead_of_tabs" : true,
216 "bool vexpand" : true,
217 "boolean show_line_marks" : true,
218 "boolean show_line_numbers" : true,
219 "css_classes" : "{ \"code-editor\" }",
220 "gboolean highlight_current_line" : true,
225 "$ Gee.HashMap<int,string>? xmarks" : "null",
226 "$ xns" : "GtkSource",
227 "$ xtype" : "Buffer",
230 "var buf = this.el;",
231 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
232 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
233 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
234 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
235 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
236 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
237 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
238 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
241 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
242 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
243 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
249 "bool check_queued" : false,
250 "bool enable_undo" : true,
251 "bool highlight_matching_brackets" : true,
252 "bool highlight_syntax" : true,
254 "int error_line" : "-1",
258 " // check syntax??",
260 " _this.save_button.el.sensitive = true;",
261 " print(\"EDITOR CHANGED\");",
262 " this.checkSyntax();",
264 " _this.dirty = true;",
266 " // this.get('/LeftPanel.model').changed( str , false);",
274 "\tGtk.TextIter iter;",
275 "\tthis.el.get_iter_at_offset (",
276 "\t\t\tout iter, this.el.cursor_position);",
278 "\t_this.navigation.updateSelectedLine(",
279 "\t\t\t(uint)iter.get_line(),",
280 "\t\t\t(uint)iter.get_line_offset()",
288 "| bool OLDhighlightErrorsJson" : [
289 "(string type, Json.Object obj) {",
290 "\tGtk.TextIter start;",
291 "\tGtk.TextIter end; ",
292 "\tthis.el.get_bounds (out start, out end);",
294 "\tthis.el.remove_source_marks (start, end, type);",
295 "\tGLib.debug(\"highlight errors\");\t\t ",
297 "\t // we should highlight other types of errors..",
299 "\tif (!obj.has_member(type)) {",
300 "\t\tGLib.debug(\"Return has no errors\\n\");",
304 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
306 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
308 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
313 "\t//this.marks = new Gee.HashMap<int,string>();",
314 "\tvar err = obj.get_object_member(type);",
316 "\tif (_this.file == null) {",
317 "\t\tGLib.debug(\"file is null?\");",
321 "\tvar valafn = _this.file.path;",
323 "\tif (_this.file.xtype != \"PlainFile\") {",
325 "\t\tvalafn = \"\";",
327 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
328 "\t\t\t// should not happen",
329 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
330 "\t\t} catch (GLib.RegexError e) {",
331 "\t\t\treturn true;",
337 "\tif (!err.has_member(valafn)) {",
338 "\t\tGLib.debug(\"File path has no errors\");",
342 "\tvar lines = err.get_object_member(valafn);",
345 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
346 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
350 "\tvar tlines = this.el.get_line_count () +1;",
352 "\tif (_this.prop != null) {",
354 "\t\ttlines = _this.prop.end_line + 1;",
355 "\t\toffset = _this.prop.start_line + 1;",
361 "\tlines.foreach_member((obj, line, node) => {",
363 "\t Gtk.TextIter iter;",
364 "// print(\"get inter\\n\");",
365 "\t var eline = int.parse(line) - offset;",
366 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
369 "\t if (eline > tlines || eline < 0) {",
374 "\t this.el.get_iter_at_line( out iter, eline);",
375 "\t //print(\"mark line\\n\");",
376 "\t var msg = \"\";",
377 "\t var ar = lines.get_array_member(line);",
378 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
379 "\t \tif (ar.get_string_element(i) == \"Success\") {",
382 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
383 "\t\t\tmsg += ar.get_string_element(i);",
385 "\t\tif (msg == \"\") {",
388 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
389 "\t this.el.create_source_mark(msg, type, iter);",
390 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
391 "\t // this.marks.set(eline, msg);",
402 "| bool checkSyntax" : [
406 " var str = this.toString();",
409 " if (this.error_line > 0) {",
410 " Gtk.TextIter start;",
411 " Gtk.TextIter end; ",
412 " this.el.get_bounds (out start, out end);",
414 " this.el.remove_source_marks (start, end, null);",
416 " if (str.length < 1) {",
417 " print(\"checkSyntax - empty string?\\n\");",
421 " // bit presumptiona",
422 " if (_this.file.xtype == \"PlainFile\") {",
424 " // assume it's gtk...",
425 " var oldcode =_this.file.toSource();",
426 " _this.file.setSource(str);",
427 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
428 " \t_this.file.getLanguageServer().document_change(_this.file);",
429 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
430 " _this.file.setSource(oldcode);",
436 " if (_this.file == null) {",
444 " GLib.debug(\"calling validate\"); ",
445 " // clear the buttons.",
446 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
449 "\tvar oldcode = _this.prop.val;",
451 "\t_this.prop.val = str;",
452 "\t_this.node.updated_count++;",
453 " _this.file.getLanguageServer().document_change(_this.file);",
454 " _this.node.updated_count++;",
455 " _this.prop.val = oldcode;",
458 " //print(\"done mark line\\n\");",
460 " return true; // at present allow saving - even if it's invalid..",
464 "| bool highlightErrors" : [
465 "( Gee.HashMap<int,string> validate_res) {",
467 "\tthis.error_line = validate_res.size;",
469 "\tif (this.error_line < 1) {",
472 "\tvar tlines = this.el.get_line_count ();",
473 "\tGtk.TextIter iter;",
474 "\tvar valiter = validate_res.map_iterator();",
475 "\twhile (valiter.next()) {",
477 "\t// print(\"get inter\\n\");",
478 "\t\tvar eline = valiter.get_key();",
479 "\t\tif (eline > tlines) {",
482 "\t\tthis.el.get_iter_at_line( out iter, eline);",
483 "\t\t//print(\"mark line\\n\");",
484 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
489 "| string toString" : [
494 " this.el.get_start_iter(out s);",
495 " this.el.get_end_iter(out e);",
496 " var ret = this.el.get_text(s,e,true);",
497 " //print(\"TO STRING? \" + ret);",
504 "# bool is_control" : false,
509 "(keyval, keycode, state) => {",
511 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
512 " \t\tthis.is_control = true;",
519 "(keyval, keycode, state) => {",
521 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
522 " \t\tthis.is_control = false;",
524 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
525 " GLib.debug(\"SAVE: ctrl-S pressed\");",
526 " _this.saveContents();",
530 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
531 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
532 "\t\t_this.forwardSearch(true);",
535 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
536 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
537 "\t\t_this.search_entry.el.grab_focus();",
538 "\t\t_this.search_entry.el.select_region(0,-1);",
541 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
542 "\t\t_this.view.el.show_completion();",
545 "\tGtk.TextIter iter;",
546 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
547 "\tvar line = iter.get_line();",
548 "\tvar offset = iter.get_line_offset();",
549 "\tGLib.debug(\"line %d off %d\", line ,offset);",
550 "\tif (_this.prop != null) {",
551 "\t\tline += _this.prop.start_line + 1; // i think..",
552 "\t\toffset += 12; // should probably be 8 without namespaced ",
553 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
555 " //_this.view.el.show_completion();",
556 " // print(event.key.keyval)",
566 "xtype" : "EventControllerKey"
569 "# double distance" : "0.0f",
571 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
575 "\tif (!_this.keystate.is_control) {",
578 "\t //GLib.debug(\"scroll %f\", dy);",
580 "\tthis.distance += dy;",
582 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
584 "\t if (this.distance < -1) {",
586 "\t\tBuilderApplication.settings.editor_font_size ++;",
587 "\t\tthis.distance = 0;",
589 "\tif (this.distance > 1) {",
590 "\t\tBuilderApplication.settings.editor_font_size --;",
591 "\t\tthis.distance = 0;",
599 "xtype" : "EventControllerScroll"
605 "(n_press, x, y) => {",
606 "\tGtk.TextIter iter;",
607 "\tint buffer_x, buffer_y;",
608 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
610 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
611 "\t\t(int)x - gut.get_width(), (int)y,",
612 " \t\tout buffer_x, out buffer_y);",
613 "\t_this.view.el.get_iter_at_location (out iter, ",
614 "\t\t\tbuffer_x, buffer_y);;",
617 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
618 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
622 "\tvar back = iter.copy();",
623 "\tback.backward_char();",
625 "\tvar forward = iter.copy();",
626 "\tforward.forward_char();",
628 "\t// what's the character at the iter?",
629 "\tvar str = back.get_text(iter);",
630 "\tstr += iter.get_text(forward);",
631 "\tif (str.strip().length < 1) {",
634 "\tvar offset = iter.get_line_offset();",
635 "\tvar line = iter.get_line();",
636 "\tif (_this.prop != null) {",
638 "\t\tline += _this.prop.start_line ; ",
639 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
640 "\t\toffset += _this.node.node_pad.length;",
641 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
642 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
643 "\t\t\toffset += 2;",
647 "\tvar ls = _this.file.getLanguageServer();",
649 "\t\t_this.file, line, offset,",
651 "\t\t\tvar res = ls.hover.end(o );",
656 "\t\t\tthings that can ber returned..",
657 "\t\t\t\"int\" (type only)",
659 "\t\t\tEditor xxxx._thisJ",
660 "\t\t\tJsrennder.jsrender Editor.file ",
661 "\t\t\tPalete.LanguageClient? JsRender.JsRender.getLanguageServer ()",
662 "\t\t\tPalete.LanguageClient? ls = _this.file.getLanguageServer()",
663 "\t\t\tasync Lsp.Hover Palete.LanguageClient.hover (JsRender.JsRender file, int line, int offset) throws GLib.Error",
664 "\t\t\t.string JsRender.Node.node_pad = \\\"\\\" ",
665 "\t\t\tGtk.TextIter iter",
667 "\t\t string Gtk.TextIter.get_text (Gtk.TextIter end)",
672 "\t\t // could never get this to work anywhere..",
673 "\t\t // looks like its probably for calling stuff..",
674 "\t\t // but always returns null..",
676 "\tls.signatureHelp.begin(",
677 "\t\t_this.file, iter.get_line(), iter.get_line_offset(),",
679 "\t\t\tvar res = ls.signatureHelp.end(o );",
688 "xtype" : "GestureClick"
693 "(x, y, keyboard_tooltip, tooltip) => {",
695 "\t//GLib.debug(\"query tooltip\");",
696 "\tGtk.TextIter iter;",
699 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
701 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
703 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
704 "\t//\treturn false;",
707 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
709 "\tvar l = iter.get_line();",
713 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
719 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
720 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
721 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
729 "\t// this crashes?? - not sure why.",
730 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
731 "\tif (marks.is_empty()) {",
732 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
734 "\tif (marks.is_empty()) {",
735 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
738 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
740 "\tmarks.@foreach((m) => { ",
741 "\t\t//GLib.debug(\"got mark %s\", m.name);",
742 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
744 "\t// true if there is a mark..",
745 "\tif (str.length > 0 ) {",
746 "\t\ttooltip.set_text( str );",
748 "\treturn str.length > 0 ? true : false;",
754 "string name" : "editor-view",
755 "uint tab_width" : 4,
760 "// show the help page for the active node..",
761 " //this.get('/Help').show();",
763 " // this.get('/BottomPane').el.set_current_page(0);",
764 " \tGLib.debug(\"load called - Reset undo buffer\");",
766 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
767 " buf.begin_irreversible_action();",
768 " buf.set_text(str, str.length);",
769 " buf.end_irreversible_action();",
771 " var lm = GtkSource.LanguageManager.get_default();",
772 " var lang = \"vala\";",
773 " if (_this.file != null) {",
774 " lang = _this.file.language;",
776 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
777 " var lg = _this.file.content_type.length > 0 ?",
778 " lm.guess_language(_this.file.path, _this.file.content_type) :",
779 " lm.get_language(lang);",
782 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
784 " this.el.insert_spaces_instead_of_tabs = true;",
785 " if (lg != null) {",
786 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
787 "\t\tif (lg.name == \"Vala\") {",
788 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
791 " _this.dirty = false;",
792 " this.el.grab_focus();",
793 " _this.save_button.el.sensitive = false;",
794 " _this.last_error_counter = -1;",
799 "xtype" : "ScrolledWindow"
804 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
805 "bool homogeneous" : false,
806 "bool vexpand" : false,
811 "Gtk.CssProvider css" : "",
812 "bool hexpand" : true,
813 "id" : "search_entry",
819 "(keyval, keycode, state) => {",
821 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
822 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
823 "\t\t_this.forwardSearch(true);",
828 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
829 "\t\t_this.forwardSearch(true);",
835 " // print(event.key.keyval)",
842 "xtype" : "EventControllerKey"
849 "_this.search(_this.search_entry.el.text);",
850 "\t _this.search_results.updateResults();",
852 "\tGLib.Timeout.add_seconds(1,() => {",
853 "\t\t _this.search_results.updateResults();",
854 "\t\t return false;",
860 "string name" : "editor-search-entry",
861 "string placeholder_text" : "Press enter to search",
862 "uint search_delay" : 3,
863 "xtype" : "SearchEntry",
864 "| void forwardSearch" : [
865 "(bool change_focus) {",
868 "\t_this.forwardSearch(change_focus);",
872 "\tswitch(_this.windowstate.state) {",
873 "\t\tcase WindowState.State.CODEONLY:",
874 "\t\t//case WindowState.State.CODE:",
875 "\t\t\t// search the code being edited..",
876 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
879 "\t\tcase WindowState.State.PREVIEW:",
880 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
881 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
883 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
896 "id" : "search_results",
897 "int margin_end" : 4,
898 "int margin_start" : 4,
899 "string label" : "No Results",
901 "| void updateResults" : [
903 "\tthis.el.visible = true;",
905 "\tvar res = _this.searchcontext.get_occurrences_count();",
907 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
911 "\t_this.nextBtn.el.sensitive = false;",
912 "\t_this.backBtn.el.sensitive = false;\t",
915 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
916 "\t\t_this.nextBtn.el.sensitive = true;",
917 "\t\t_this.backBtn.el.sensitive = true;",
920 "\t_this.search_results.el.label = \"No Matches\";",
927 "bool always_show_image" : true,
928 "bool sensitive" : false,
934 "\t_this.forwardSearch(true);",
941 "string icon_name" : "go-down",
946 "bool always_show_image" : true,
947 "bool sensitive" : false,
953 "\t_this.backSearch(true);",
959 "string icon_name" : "go-up",
964 "bool always_show_arrow" : true,
965 "bool always_show_image" : true,
969 "* prop" : "popover",
970 "id" : "search_settings",
975 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
986 "id" : "case_sensitive",
987 "string label" : "Case Sensitive",
988 "xtype" : "CheckButton"
999 "string label" : "Regex",
1000 "xtype" : "CheckButton"
1005 "string label" : "Multi-line (add \\n)",
1006 "xtype" : "CheckButton"
1015 "string icon_name" : "emblem-system",
1016 "xtype" : "MenuButton"
1026 "* prop" : "end_child",
1027 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1028 "bool hexpand" : true,
1029 "bool vexpand" : true,
1034 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1040 "bool hexpand" : true,
1041 "bool vexpand" : true,
1042 "bool visible" : false,
1043 "id" : "navigationwindow",
1046 "# int last_selected_line" : "-1",
1047 "$ Gtk.Widget? selected_row" : "null",
1050 "id" : "navigation",
1054 "bool expand" : true,
1058 "* prop" : "factory",
1063 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1065 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1066 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1069 "\tvar hbox = (Gtk.Box) expand.child;",
1072 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1073 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1075 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1076 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1078 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1079 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1081 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1083 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1085 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1086 " \texpand.set_list_row(lr);",
1087 " \t//this.in_bind = true;",
1088 " \t// default is to expand",
1090 " \t//this.in_bind = false;",
1092 " \tsym.bind_property(\"symbol_icon\",",
1093 " img, \"icon_name\",",
1094 " GLib.BindingFlags.SYNC_CREATE);",
1096 " \thbox.css_classes = { sym.symbol_icon };",
1098 " \tsym.bind_property(\"name\",",
1100 " GLib.BindingFlags.SYNC_CREATE);",
1101 " \t// should be better?- --line no?",
1102 " \tsym.bind_property(\"tooltip\",",
1103 " lbl, \"tooltip_markup\",",
1104 " GLib.BindingFlags.SYNC_CREATE);",
1105 " \t// bind image...",
1113 "\tvar expand = new Gtk.TreeExpander();",
1115 "\texpand.set_indent_for_depth(true);",
1116 "\texpand.set_indent_for_icon(true);",
1117 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1118 "\tvar icon = new Gtk.Image();",
1119 "\tvar lbl = new Gtk.Label(\"\");",
1120 "\tlbl.use_markup = true;",
1121 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1123 "\ticon.margin_end = 4;",
1124 " \tlbl.justify = Gtk.Justification.LEFT;",
1125 " \tlbl.xalign = 0;",
1127 "//\tlistitem.activatable = true; ??",
1129 "\thbox.append(icon);",
1130 "\thbox.append(lbl);",
1131 "\texpand.set_child(hbox);",
1132 "\t((Gtk.ListItem)listitem).set_child(expand);",
1138 "xtype" : "SignalListItemFactory"
1141 "string title" : "Code Navigation",
1142 "xtype" : "ColumnViewColumn"
1147 "id" : "navigationselmodel",
1152 "id" : "navigationsort",
1155 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1158 "\treturn ((Lsp.DocumentSymbol)item).children;",
1164 "bool autoexpand" : true,
1165 "bool passthrough" : false,
1168 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1171 "id" : "navliststore",
1172 "xtype" : "ListStore",
1173 "| Lsp.DocumentSymbol? symbolAtLine" : [
1174 "(uint line, uint chr) {",
1177 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1178 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1179 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1180 "\t\t//\tel.name , (int)el.range.start.line,",
1181 "\t\t//\t(int)el.range.end.line",
1183 "\t\tvar ret = el.containsLine(line,chr);",
1184 "\t\tif (ret != null) {",
1185 "\t\t\treturn ret;",
1197 "(position, removed, added) => {",
1198 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1199 "\t if (added < 1) { ",
1202 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1203 "\tvar row = this.el.get_row(position);",
1205 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1212 "xtype" : "TreeListModel"
1216 "* prop" : "sorter",
1220 "* prop" : "sorter",
1223 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1225 "* prop" : "expression",
1226 "string property_name" : "sort_key",
1227 "xtype" : "PropertyExpression"
1230 "xtype" : "StringSorter"
1233 "xtype" : "TreeListRowSorter"
1236 "xtype" : "SortListModel",
1237 "| Lsp.DocumentSymbol? getSymbolAt" : [
1240 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1242 " var a = tr.get_item();; ",
1243 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1246 " return (Lsp.DocumentSymbol)tr.get_item();",
1250 "| int getRowFromSymbol" : [
1251 "(Lsp.DocumentSymbol sym) {",
1253 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1254 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1256 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1263 "| void collapseOnLoad" : [
1265 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1266 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1267 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1268 "\t\tswitch (sym.kind) {",
1269 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1270 "\t \t\t\ttr.expanded = false;",
1273 "\t\t\t\t//tr.expanded = true;",
1285 "xtype" : "NoSelection"
1291 "(n_press, x, y) => {",
1293 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1295 " if (row == null) {",
1296 "\t GLib.debug(\"no row selected items\");",
1299 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1300 " //Lsp.DocumentSymbol",
1301 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1302 " if (sym == null) {",
1308 " \"line\" : 1410,",
1309 " \"character\" : 8",
1312 " \"line\" : 1410,",
1313 " \"character\" : 39",
1317 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1318 " _this.scroll_to_line((int)sym.range.start.line);",
1319 " Gtk.TextIter iter;",
1320 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1321 " \t(int)sym.range.start.line,",
1322 " \t(int)sym.range.start.character",
1324 " _this.buffer.el.place_cursor(iter);",
1329 "xtype" : "GestureClick"
1332 "string name" : "editor-navigation",
1333 "xtype" : "ColumnView",
1334 "| Gtk.Widget? getRowWidgetAt" : [
1335 "(double x, double y, out string pos) {",
1338 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1339 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1340 "\tif (w == null) {",
1344 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1345 "\tif (row == null) {",
1349 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1353 "\t//GLib.debug(\"row number is %d\", rn);",
1354 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1355 "\t// above or belw",
1356 "\tGraphene.Rect bounds;",
1357 "\trow.compute_bounds(this.el, out bounds);",
1358 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1359 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1360 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1362 "\tvar ypos = y - bounds.get_y();",
1363 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1364 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1365 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1366 "\tpos = \"over\";",
1368 "\tif (rpos > 80) {",
1369 "\t\tpos = \"below\";",
1370 "\t} else if (rpos < 20) {",
1371 "\t\tpos = \"above\";",
1376 "| int getRowAt" : [
1377 "(double x, double y, out string pos) {",
1380 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1381 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1382 "\tif (w == null) {",
1386 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1387 "\tif (row == null) {",
1391 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1396 "\twhile (cr.get_prev_sibling() != null) {",
1398 "\t\tcr = cr.get_prev_sibling();",
1401 "\t//GLib.debug(\"row number is %d\", rn);",
1402 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1403 "\t// above or belw",
1404 "\tGraphene.Rect bounds;",
1405 "\trow.compute_bounds(this.el, out bounds);",
1406 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1407 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1408 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1410 "\tvar ypos = y - bounds.get_y();",
1411 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1412 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1413 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1414 "\tpos = \"over\";",
1416 "\tif (rpos > 80) {",
1417 "\t\tpos = \"below\";",
1418 "\t} else if (rpos < 20) {",
1419 "\t\tpos = \"above\";",
1425 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1426 "\t_this.navigationwindow.el.show();",
1427 "\t//_this.navliststore.el.remove_all();",
1430 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1432 "\tforeach(var sym in syms) {",
1433 "\t\tls.append(sym);",
1435 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1436 "\t//_this.navliststore.el.append(sym);",
1437 "\tthis.last_selected_line = -1;",
1438 "\tGLib.Idle.add(() => {",
1439 "\t\t_this.navigationsort.collapseOnLoad();",
1440 "\t\tGtk.TextIter iter;",
1441 "\t\t_this.buffer.el.get_iter_at_offset (",
1442 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1444 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1445 "\t\t\t\titer.get_line_offset());",
1446 "\t\tthis.updateSelectedLine(",
1447 "\t\t\t\t(uint)iter.get_line(),",
1448 "\t\t\t\t(uint)iter.get_line_offset()",
1450 "\t\treturn false;",
1455 "| void updateSelectedLine" : [
1456 "(uint line, uint chr) {",
1457 "\tif (line == this.last_selected_line) {",
1460 "\tGLib.debug(\"select line %d\", (int)line);",
1461 "\tthis.last_selected_line = (int)line;",
1464 "\tvar new_row = -1;",
1465 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1466 "\tif (sym != null) {",
1467 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1468 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1470 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1473 "\tif (this.selected_row != null) { ",
1474 "\t\tGLib.debug(\" remove selected row\");",
1475 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1477 "\tthis.selected_row = null;",
1478 "\tif (new_row > -1) {",
1479 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1480 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1481 "\t\tif (row != null) {",
1482 "\t\t\tGLib.debug(\" Add selected row\");",
1484 "\t\t\trow.add_css_class(\"selected-row\");",
1485 "\t\t\tthis.selected_row = row;",
1489 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1499 "xtype" : "ScrolledWindow"
1509 "| bool saveContents" : [
1513 " if (_this.file == null) {",
1519 " var str = _this.buffer.toString();",
1521 " _this.buffer.checkSyntax();",
1525 " // LeftPanel.model.changed( str , false);",
1526 " _this.dirty = false;",
1527 " _this.save_button.el.sensitive = false;",
1529 " // find the text for the node..",
1530 " if (_this.file.xtype != \"PlainFile\") {",
1531 " // in theory these properties have to exist!?!",
1532 " \tthis.prop.val = str;",
1533 " //this.window.windowstate.left_props.reload();",
1535 " _this.file.setSource( str );",
1538 " // call the signal..",
1546 "(string in_txt) {",
1548 "\tvar s = new GtkSource.SearchSettings();",
1549 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1550 "\ts.regex_enabled = _this.regex.el.active;\t",
1551 "\ts.wrap_around = false;",
1553 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1554 "\tthis.searchcontext.set_highlight(true);",
1555 "\tvar txt = in_txt;",
1557 "\tif (_this.multiline.el.active) {",
1558 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1561 "\ts.set_search_text(txt);",
1562 "\tGtk.TextIter beg, st,en;",
1564 "\tthis.buffer.el.get_start_iter(out beg);",
1565 "\tbool has_wrapped_around;",
1566 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1567 "\tthis.last_search_end = 0;",
1569 "\treturn this.searchcontext.get_occurrences_count();",
1577 "| string tempFileContents" : [
1581 " if (_this.file == null) {",
1584 "\tvar str= this.buffer.toString();",
1585 "\tif (_this.file.xtype == \"PlainFile\") {",
1593 " GLib.debug(\"calling validate\"); ",
1594 " // clear the buttons.",
1595 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1596 "\t\treturn this.file.toSource(); ;",
1599 "\tvar oldcode = _this.prop.val;",
1600 "\t_this.prop.val = str;",
1601 " var ret = _this.file.toSource();",
1602 " _this.prop.val = oldcode;",
1607 "| void backSearch" : [
1608 "(bool change_focus) {",
1610 "\tif (this.searchcontext == null) {",
1614 "\tGtk.TextIter beg, st,en;",
1615 "\tbool has_wrapped_around;",
1616 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1618 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1619 "\t\tthis.last_search_end = 0;",
1621 "\t\tthis.last_search_end = en.get_offset();",
1622 "\t\tif (change_focus) {",
1623 "\t\t\tthis.view.el.grab_focus();",
1625 "\t\tthis.buffer.el.place_cursor(st);",
1626 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1632 "| void forwardSearch" : [
1633 "(bool change_focus) {",
1635 "\tif (this.searchcontext == null) {",
1639 "\tGtk.TextIter beg, st,en;",
1640 "\t bool has_wrapped_around;",
1641 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1642 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1644 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1646 "\t\tif (has_wrapped_around) {",
1650 "\t\tthis.last_search_end = en.get_offset();",
1651 "\t\tif (change_focus) {",
1652 "\t\t\tthis.view.el.grab_focus();",
1654 "\t\tthis.buffer.el.place_cursor(st);",
1655 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1663 "\t this.file = null; ",
1665 " this.node = null;",
1666 " this.prop = null;",
1667 "\tthis.searchcontext = null;",
1672 "| void scroll_to_line" : [
1675 "\tGLib.Timeout.add(500, () => {",
1677 "\t\tvar buf = this.view.el.get_buffer();",
1679 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1682 "\t\tGtk.TextIter iter; ",
1683 "\t\tsbuf.get_iter_at_line(out iter, line);",
1684 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1685 "\t\treturn false;",
1691 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1694 " if (this.file != null) {",
1695 " \tthis.file.navigation_tree_updated.disconnect(",
1696 " \t\t_this.navigation.show",
1699 " this.file = file; ",
1700 " this.file.navigation_tree_updated.connect(",
1701 "\t\t_this.navigation.show",
1703 " if (file.xtype != \"PlainFile\") {",
1704 " \tthis.prop = prop;",
1705 " this.node = node;",
1707 " // find the text for the node..",
1708 " this.view.load( prop.val );",
1709 " this.updateErrorMarks();",
1713 " this.close_btn.el.show(); ",
1716 " this.view.load( file.toSource() );",
1717 " this.updateErrorMarks();",
1718 " this.close_btn.el.hide();",
1719 " var ls = file.getLanguageServer();",
1720 " ls.queueDocumentSymbols(file);",
1721 " ////ls.documentSymbols.begin(file, (a,o) => {",
1722 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1724 " //documentSymbols",
1730 "| void updateErrorMarks" : [
1735 "\tvar buf = _this.buffer.el;",
1736 "\tGtk.TextIter start;",
1737 "\tGtk.TextIter end; ",
1738 "\tbuf.get_bounds (out start, out end);",
1743 "\t//GLib.debug(\"highlight errors\");\t\t ",
1745 "\t // we should highlight other types of errors..",
1747 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1749 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1751 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1757 "\tif (_this.file == null) {",
1758 "\t\tGLib.debug(\"file is null?\");",
1762 "\tvar ar = this.file.getErrors();",
1763 "\tif (ar.size < 1) {",
1764 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1765 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1766 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1767 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1768 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1769 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1770 "\t\tthis.last_error_counter = file.error_counter ;",
1771 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1776 " // basicaly check if there is no change, then we do not do any update..",
1777 " // we can do this by just using an error counter?",
1778 " // if that's changed then we will do an update, otherwise dont bother.",
1781 "\tvar offset = 0;",
1782 "\tvar hoffset = 0;",
1784 "\tvar tlines = buf.get_line_count () +1;",
1786 "\tif (_this.prop != null) {",
1787 "\t\t// this still seems flaky...",
1789 "\t\ttlines = _this.prop.end_line;",
1790 "\t\toffset = _this.prop.start_line;",
1791 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1795 "\t\t// no update...",
1796 "\t\tif (this.last_error_counter == file.error_counter) {",
1802 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1803 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1804 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1805 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1806 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1807 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1809 "\tforeach(var diag in ar) { ",
1810 "\t Gtk.TextIter iter;",
1811 "// print(\"get inter\\n\");",
1812 "\t var eline = (int)diag.range.start.line - offset;",
1813 "\t var eline_to = (int)diag.range.end.line - offset;",
1814 "\t //var eline = diag.range.end_line - offset;",
1815 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1816 "\t //\terr.line ,eline, offset);",
1819 "\t if (eline > tlines || eline < 0) {",
1823 "\t buf.get_iter_at_line( out iter, eline);",
1824 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1825 "\t buf.create_source_mark( msg, diag.category, iter);",
1827 " \t var spos = (int)diag.range.start.character - hoffset;",
1828 " \t if (spos < 0) { spos =0 ; }",
1829 " \t if (spos > iter.get_chars_in_line()) {",
1830 " \t \tspos = iter.get_chars_in_line();",
1832 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1833 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1834 " \t if (epos < 0) { epos =0 ; }",
1835 " \t if (epos > iter.get_chars_in_line()) {",
1836 " \t \tepos = iter.get_chars_in_line();",
1840 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1842 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1844 "\t buf.apply_tag_by_name(diag.category, start, end);",
1846 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1847 "\t //this.marks.set(eline, msg);",
1849 "\tthis.last_error_counter = file.error_counter ;",