"# string prop_selected" : "\"\"",
"$ xns" : "GtkSource",
"* init" : [
- "{",
- " ",
- " this.css = new Gtk.CssProvider();",
+ "\t{",
+ "",
+ "\tthis.css = new Gtk.CssProvider();",
"\t ",
"\tthis.css.load_from_string(",
"\t\t\"#roo-view { font: 10px monospace; }\"",
"\t);",
- " ",
+ "",
"\tGtk.StyleContext.add_provider_for_display(",
"\t\tthis.el.get_display(),",
"\t\tthis.css,",
"\t);",
"\t\t",
"\t ",
- " ",
- " this.loading = true;",
- " //var buf = this.el.get_buffer();",
- " //buf.notify.connect(this.onCursorChanged);",
- " ",
- " ",
- " var attrs = new GtkSource.MarkAttributes();",
- " var pink = Gdk.RGBA();",
- " pink.parse ( \"pink\");",
- " attrs.set_background ( pink);",
- " attrs.set_icon_name ( \"process-stop\"); ",
- " attrs.query_tooltip_text.connect(( mark) => {",
- " //print(\"tooltip query? %s\\n\", mark.name);",
- " return mark.name;",
- " });",
- " ",
- " this.el.set_mark_attributes (\"ERR\", attrs, 1);",
- " ",
- " var wattrs = new GtkSource.MarkAttributes();",
- " var blue = Gdk.RGBA();",
- " blue.parse ( \"#ABF4EB\");",
- " wattrs.set_background ( blue);",
- " wattrs.set_icon_name ( \"process-stop\"); ",
- " wattrs.query_tooltip_text.connect(( mark) => {",
- " //print(\"tooltip query? %s\\n\", mark.name);",
- " return mark.name;",
- " });",
- " ",
- " this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
- " ",
- " ",
- " ",
- " var dattrs = new GtkSource.MarkAttributes();",
- " var purple = Gdk.RGBA();",
- " purple.parse ( \"#EEA9FF\");",
- " dattrs.set_background ( purple);",
- " dattrs.set_icon_name ( \"process-stop\"); ",
- " dattrs.query_tooltip_text.connect(( mark) => {",
- " //print(\"tooltip query? %s\\n\", mark.name);",
- " return mark.name;",
- " });",
- " ",
- " this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
- " ",
- " ",
- " var gattrs = new GtkSource.MarkAttributes();",
- " var grey = Gdk.RGBA();",
- " grey.parse ( \"#ccc\");",
- " gattrs.set_background ( grey);",
+ "",
+ "\tthis.loading = true;",
+ "\t//var buf = this.el.get_buffer();",
+ "\t//buf.notify.connect(this.onCursorChanged);",
+ "",
+ "",
+ "\tvar attrs = new GtkSource.MarkAttributes();",
+ "\tattrs.set_icon_name ( \"process-stop\"); ",
+ "\tattrs.query_tooltip_text.connect(( mark) => {",
+ "\t\t//print(\"tooltip query? %s\\n\", mark.name);",
+ "\t\treturn mark.name;",
+ "\t});",
+ "",
+ "\tthis.el.set_mark_attributes (\"ERR\", attrs, 1);",
+ "",
+ "\t var wattrs = new GtkSource.MarkAttributes();",
+ "\twattrs.set_icon_name ( \"process-stop\"); ",
+ "\twattrs.query_tooltip_text.connect(( mark) => {",
+ "\t\t//print(\"tooltip query? %s\\n\", mark.name);",
+ "\t\treturn mark.name;",
+ "\t});",
+ "",
+ "\tthis.el.set_mark_attributes (\"WARN\", wattrs, 1);",
+ "",
+ "",
+ "",
+ "\t var dattrs = new GtkSource.MarkAttributes();",
+ "\tdattrs.set_icon_name ( \"process-stop\"); ",
+ "\tdattrs.query_tooltip_text.connect(( mark) => {",
+ "\t\t//print(\"tooltip query? %s\\n\", mark.name);",
+ "\t\treturn mark.name;",
+ "\t});",
+ "",
+ "\tthis.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
+ "",
+ "",
+ "\tvar gattrs = new GtkSource.MarkAttributes();",
+ "\tvar grey = Gdk.RGBA();",
+ "\tgrey.parse ( \"#ccc\");",
+ "\tgattrs.set_background ( grey);",
+ "",
+ "",
+ "\tthis.el.set_mark_attributes (\"grey\", gattrs, 1);",
+ "",
+ "",
" ",
- " ",
- " this.el.set_mark_attributes (\"grey\", gattrs, 1);",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "}",
- " "
+ "",
+ "",
+ "\t}",
+ ""
],
"* pack" : "set_child",
"Gtk.CssProvider css" : "",
"items" : [
{
"$ xns" : "GtkSource",
+ "* init" : [
+ "{",
+ "\tvar buf = this.el;",
+ "\tbuf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
+ "\tbuf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
+ "\tbuf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
+ "\tbuf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
+ "\tbuf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
+ "\tbuf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
+ "\tbuf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
+ "\tbuf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
+ "",
+ "",
+ "\tbuf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
+ "\tbuf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
+ "\tbuf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
+ "}",
+ "",
+ ""
+ ],
"* pack" : "set_buffer",
"bool dirty" : false,
"bool in_cursor_change" : false,
]
},
"xtype" : "Buffer",
- "| bool highlightErrors" : [
- "( Gee.HashMap<int,string> validate_res) {",
- " ",
- " this.error_line = validate_res.size;",
- "\t",
- " if (this.error_line < 1) {",
- " return true;",
- " }",
- " var tlines = this.el.get_line_count ();",
- " Gtk.TextIter iter;",
- " var valiter = validate_res.map_iterator();",
- " while (valiter.next()) {",
- " ",
- "// print(\"get inter\\n\");",
- " var eline = valiter.get_key();",
- " if (eline > tlines) {",
- " continue;",
- " }",
- " this.el.get_iter_at_line( out iter, eline);",
- " //print(\"mark line\\n\");",
- " this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
- " } ",
- " return false;",
- "}"
- ],
"| string toString" : [
" () {",
" ",
"}",
""
],
- "| void highlightErrorsJson" : [
- " (string type, Json.Object obj) {",
- " // this is a hook for the vala code - it has no value in javascript ",
- " // as we only have one error ususally....",
- " return ;",
- " ",
- " ",
- "",
- "",
- "}"
- ],
"| void loadFile" : [
"( ) {",
" this.loading = true;",
"\t}",
"\tvar ar = this.file.getErrors();",
"\tif (ar.size < 1) {",
+ "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
+ "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
+ "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
"\t\tbuf.remove_source_marks (start, end, null);",
"\t\tthis.last_error_counter = file.error_counter ;",
"\t\tGLib.debug(\"higjlight has no errors\");",
" \tif (this.last_error_counter == file.error_counter) {",
"\t\treturn;",
"\t}",
- "\t",
- "",
- " ",
- "\t ",
"",
"\tvar tlines = buf.get_line_count () +1;",
"\t",
" ",
"\t ",
"\tbuf.remove_source_marks (start, end, null);",
+ "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
+ "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
+ "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
"\tforeach(var diag in ar) { ",
"\t",
"\t\t",
"\t Gtk.TextIter iter;",
"// print(\"get inter\\n\");",
- "\t var eline = (int)diag.range.start.line + 1;",
- "\t ",
+ "\t var eline = (int)diag.range.start.line ;",
+ "\t var eline_to = (int)diag.range.end.line;",
"\t if (eline > tlines || eline < 0) {",
"\t return;",
"\t }",
"\t ",
"\t ",
- "\t buf.get_iter_at_line_offset( out iter, eline, (int)diag.range.start.character);",
+ "\t buf.get_iter_at_line( out iter, eline);",
"\t ",
+ "\t \t buf.get_iter_at_line_offset( out start, ",
+ " \t \teline, (int)diag.range.start.character); ",
+ " \t buf.get_iter_at_line_offset( out end, ",
+ " \t \teline_to, (int)diag.range.end.character); ",
+ " \t \t",
+ "\t buf.apply_tag_by_name(diag.category, start, end);",
"\t ",
"\t ",
"\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",