var css = new Gtk.CssProvider();
css.load_from_resource("/css/roobuilder.css");
-
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default(),
css ,
ww.windowstate.updateErrorMarksAll();
- GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName());
+ //GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName());
ww.updateErrors();
ww.windowstate.left_tree.updateErrors();
ww.windowstate.left_props.updateErrors();
BuilderApplication.showSpinner( "format-justify-fill", msg);
return;
+ case Palete.LanguageClientAction.DIAG_END:
+ BuilderApplication.showSpinner( "", "");
+ return;
+
case Palete.LanguageClientAction.OPEN:
BuilderApplication.showSpinner( "document-open", msg);
return;
"\t\treturn ;",
"\t});",
"\tev.ref(); //?? needed?",
- "\t(this.el as Gtk.Widget).add_controller(ev);",
+ "\t((Gtk.Widget)this.el).add_controller(ev);",
"}",
""
],
return ;
});
ev.ref(); //?? needed?
- (this.el as Gtk.Widget).add_controller(ev);
+ ((Gtk.Widget)this.el).add_controller(ev);
}
}
" this.loading = true;",
" var buf = this.el.get_buffer();",
" buf.set_text(\"\",0);",
- " var sbuf = (GtkSource.Buffer) buf;",
+ " ",
"\tvar cpos = buf.cursor_position;",
" ",
" \tprint(\"BEFORE LOAD cursor = %d\\n\", cpos);",
"",
"",
" ",
- "\tGLib.debug(\"highlight errors\");\t\t ",
+ "\t//GLib.debug(\"highlight errors\");\t\t ",
"",
"\t // we should highlight other types of errors..",
"",
"\t\tbuf.remove_source_marks (start, end, \"WARN\");",
"\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\t\tthis.last_error_counter = file.error_counter ;",
- "\t\tGLib.debug(\"higjlight has no errors\");",
+ "\t\t//GLib.debug(\"higjlight has no errors\");",
"\t\treturn;",
"\t}",
" \tif (this.last_error_counter == file.error_counter) {",
- GLib.debug("highlight errors");
+ //GLib.debug("highlight errors");
// we should highlight other types of errors..
buf.remove_source_marks (start, end, "WARN");
buf.remove_source_marks (start, end, "DEPR");
this.last_error_counter = file.error_counter ;
- GLib.debug("higjlight has no errors");
+ //GLib.debug("higjlight has no errors");
return;
}
if (this.last_error_counter == file.error_counter) {
this.loading = true;
var buf = this.el.get_buffer();
buf.set_text("",0);
- var sbuf = (GtkSource.Buffer) buf;
+
var cpos = buf.cursor_position;
print("BEFORE LOAD cursor = %d\n", cpos);
"\tif (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) {",
"\t\treturn;",
"\t}",
- "\tGLib.debug(",
- "\t",
- "\t\t\"searcj key release %d, %d, %d ?= %d\" , ",
- "\t\t\t(int) keyval, (int) keycode, state,",
- "\t\t\t(int)Gdk.Key.Return",
- "\t\t);",
+ "\t//GLib.debug(",
+ "\t//\t\"searcj key release %d, %d, %d ?= %d\" , ",
+ "\t//\t\t(int) keyval, (int) keycode, state,",
+ "\t//\t\t(int)Gdk.Key.Return",
+ "\t//\t);",
"\tif (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) {",
"\t\treturn;",
"\t}",
],
"key_released" : [
"(keyval, keycode, state) => {",
- "\tGLib.debug(",
- "\t",
- "\t\t\"key release %d, %d, %d ?= %d %d\" , ",
- "\t\t\t(int) keyval, (int) keycode, state,",
- "\t\t\t(int)Gdk.Key.O, Gdk.ModifierType.CONTROL_MASK",
- "\t\t);",
+ "\t//GLib.debug(",
+ "\t//\t\"key release %d, %d, %d ?= %d %d\" , ",
+ "\t//\t\t(int) keyval, (int) keycode, state,",
+ "\t//\t\t(int)Gdk.Key.O, Gdk.ModifierType.CONTROL_MASK",
+ "\t//\t);",
" \tif (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {",
" \t\tthis.is_shift = 0;",
"\t}",
if (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) {
return;
}
- GLib.debug(
-
- "searcj key release %d, %d, %d ?= %d" ,
- (int) keyval, (int) keycode, state,
- (int)Gdk.Key.Return
- );
+ //GLib.debug(
+ // "searcj key release %d, %d, %d ?= %d" ,
+ // (int) keyval, (int) keycode, state,
+ // (int)Gdk.Key.Return
+ // );
if (!_this.treescroll.el.visible || _this.treeselmodel.el.get_n_items() < 0) {
return;
}
//listeners
this.el.key_released.connect( (keyval, keycode, state) => {
- GLib.debug(
-
- "key release %d, %d, %d ?= %d %d" ,
- (int) keyval, (int) keycode, state,
- (int)Gdk.Key.O, Gdk.ModifierType.CONTROL_MASK
- );
+ //GLib.debug(
+ // "key release %d, %d, %d ?= %d %d" ,
+ // (int) keyval, (int) keycode, state,
+ // (int)Gdk.Key.O, Gdk.ModifierType.CONTROL_MASK
+ // );
if (keyval == Gdk.Key.Shift_L || keyval == Gdk.Key.Shift_R) {
this.is_shift = 0;
}
],
"| void updateNotices" : [
"( GLib.ListStore? ls) {",
- "\tGLib.debug(\"errors : update\");",
+ "\t//GLib.debug(\"errors : update\");",
" if (ls == null || ls.get_n_items() < 1) {",
" \t// GLib.debug(\"errors : none available\");",
" \treturn;",
// user defined functions
public void updateNotices ( GLib.ListStore? ls) {
- GLib.debug("errors : update");
+ //GLib.debug("errors : update");
if (ls == null || ls.get_n_items() < 1) {
// GLib.debug("errors : none available");
return;
" \t\t ",
" \t}",
" \t*/",
- "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
+ "\t\t//GLib.debug(\"Get Widget At Row %d\", (int)row);",
" var child = this.el.get_first_child(); ",
" \tvar line_no = -1; ",
" \tvar reading_header = true;",
"",
" \twhile (child != null) {",
- "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
" \t if (reading_header) {",
"\t\t\t ",
"\t\t\t ",
"\t\t }",
"\t\t line_no++;",
"\t\t\tif (line_no == row) {",
- "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
+ "\t\t\t\t//GLib.debug(\"Returning widget %s\", child.get_type().name());",
"\t\t\t return (Gtk.Widget)child;",
"\t\t }",
"\t child = child.get_next_sibling(); ",
" \t}",
- "\t\tGLib.debug(\"Rturning null\");",
+ "\t\t//GLib.debug(\"Rturning null\");",
" return null;",
"",
" }"
"\t",
"\t\t ",
"// print(\"get inter\\n\");",
- "\t var node= file.lineToNode( (int)diag.range.start.line) ;",
- "\t if (node == null || node.oid != this.node.oid) {",
+ "\t var node = file.lineToNode( (int)diag.range.start.line) ;",
+ "\t if (node == null || this.node == null || node.oid != this.node.oid) {",
"\t \tcontinue;",
" \t}",
" \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
- " \t",
+ " \tif (prop == null) {",
+ " \t\tcontinue;",
+ "\t\t}",
" \tvar row = _this.selmodel.propToRow(prop);",
" \tif (row < 0) {",
" \t\tcontinue;",
// print("get inter\n");
- var node= file.lineToNode( (int)diag.range.start.line) ;
- if (node == null || node.oid != this.node.oid) {
+ var node = file.lineToNode( (int)diag.range.start.line) ;
+ if (node == null || this.node == null || node.oid != this.node.oid) {
continue;
}
var prop = node.lineToProp( (int)diag.range.start.line) ;
-
+ if (prop == null) {
+ continue;
+ }
var row = _this.selmodel.propToRow(prop);
if (row < 0) {
continue;
}
*/
- GLib.debug("Get Widget At Row %d", (int)row);
+ //GLib.debug("Get Widget At Row %d", (int)row);
var child = this.el.get_first_child();
var line_no = -1;
var reading_header = true;
while (child != null) {
- GLib.debug("Got %s", child.get_type().name());
+ //GLib.debug("Got %s", child.get_type().name());
if (reading_header) {
}
line_no++;
if (line_no == row) {
- GLib.debug("Returning widget %s", child.get_type().name());
+ //GLib.debug("Returning widget %s", child.get_type().name());
return (Gtk.Widget)child;
}
child = child.get_next_sibling();
}
- GLib.debug("Rturning null");
+ //GLib.debug("Rturning null");
return null;
}
"| int nodeToRow" : [
"(JsRender.Node node) ",
"{",
- "\tvar row = -1;",
+ " ",
"\tvar s = _this.view.el.model as Gtk.SingleSelection;",
"\tfor (var i = 0; i < s.n_items; i++) {",
"\t\t//GLib.debug(\"check node %s\", s.get_item(i).get_type().name());",
"\t\tvar lr = s.get_item(i) as Gtk.TreeListRow;",
"\t\t//GLib.debug(\"check node %s\", lr.get_item().get_type().name());",
- "\t\tif ((lr.get_item() as JsRender.Node).oid == node.oid) {",
+ "\t\tvar nn = (lr.get_item() as JsRender.Node);",
+ "\t\tif (nn != null && nn.oid == node.oid) {",
"\t\t\treturn i;",
"\t\t\t",
"\t\t}",
""
],
"| void selectNode" : [
- "(JsRender.Node node) ",
+ "(JsRender.Node? node) ",
"{",
- "\tvar row = this.nodeToRow(node);",
"\tvar s = _this.view.el.model as Gtk.SingleSelection;",
+ "\tif (node == null) {",
+ "\t\ts.selected=Gtk.INVALID_LIST_POSITION;",
+ "\t\treturn;",
+ "\t}",
+ "\tvar row = this.nodeToRow(node);",
+ "",
"\t ",
"\tif (row < 0) {",
"\t\t// select none?",
"\t\tGLib.debug(\"Could not find node\");",
+ "\t\ts.selected=Gtk.INVALID_LIST_POSITION;",
"\t\treturn;",
"\t}",
"\tGLib.debug(\"Select %d\", row);",
"| int getRowAt" : [
"(double x, double y, out string pos) {",
"",
+ "\tpos = \"\";",
"\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
"\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
"\tif (w == null) {",
}
public int getRowAt (double x, double y, out string pos) {
+ pos = "";
var w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);
//GLib.debug("got widget %s", w == null ? "nothing" : w.get_type().name());
if (w == null) {
}
public int nodeToRow (JsRender.Node node)
{
- var row = -1;
+
var s = _this.view.el.model as Gtk.SingleSelection;
for (var i = 0; i < s.n_items; i++) {
//GLib.debug("check node %s", s.get_item(i).get_type().name());
var lr = s.get_item(i) as Gtk.TreeListRow;
//GLib.debug("check node %s", lr.get_item().get_type().name());
- if ((lr.get_item() as JsRender.Node).oid == node.oid) {
+ var nn = (lr.get_item() as JsRender.Node);
+ if (nn != null && nn.oid == node.oid) {
return i;
}
_this.selmodel.el.set_model(this.el);
return this.el;
}
- public void selectNode (JsRender.Node node)
+ public void selectNode (JsRender.Node? node)
{
- var row = this.nodeToRow(node);
var s = _this.view.el.model as Gtk.SingleSelection;
+ if (node == null) {
+ s.selected=Gtk.INVALID_LIST_POSITION;
+ return;
+ }
+ var row = this.nodeToRow(node);
+
if (row < 0) {
// select none?
GLib.debug("Could not find node");
+ s.selected=Gtk.INVALID_LIST_POSITION;
return;
}
GLib.debug("Select %d", row);
if (!GLib.FileUtils.test(this.path, GLib.FileTest.EXISTS)) {
return null;
}
- this._icon = File.new_for_path(this.path).query_info("standard::icon",GLib.FileQueryInfoFlags.NONE).get_icon();
+ try {
+ this._icon = File.new_for_path(this.path).query_info("standard::icon",GLib.FileQueryInfoFlags.NONE).get_icon();
+ } catch(GLib.Error e) {
+ return null;
+ }
return this._icon;
}
}
var new_version = this.version + step;
var pa = new Json.Parser();
//GLib.debug("UNDO RESTORE : %d", this.version + step);
-
- pa.load_from_data(this.undo_json.get(new_version));
+ try {
+ pa.load_from_data(this.undo_json.get(new_version));
+ } catch (GLib.Error e) {
+ return false;
+ }
var node = pa.get_root();
this.in_undo = true;
this.loadTree(node.get_object(),2);
private void addError(Lsp.Diagnostic diag)
{
- GLib.debug("ADD Error %s", diag.to_string());
+ //GLib.debug("ADD Error %s", diag.to_string());
this.errors.add(diag);
this.project.addError(this, diag);
public void removeError(Lsp.Diagnostic diag)
{
- GLib.debug("REMOVE Error %s", diag.to_string());
+ //GLib.debug("REMOVE Error %s", diag.to_string());
this.errors.remove(diag);
this.project.removeError(this, diag);
this.error_counter++;
case PROP:
case RAW: // should they be the same?
- props += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
+ props += "\n\t" + (prop.rtype != null && prop.rtype.length > 0 ? GLib.Markup.escape_text(prop.rtype) : "") +
" <b>" + GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val.split("\n")[0]);
+ (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
break;
-
-
+
case METHOD :
- funcs += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
+ funcs += "\n\t" + (prop.rtype != null && prop.rtype.length > 0 ? GLib.Markup.escape_text(prop.rtype) : "") +
" <b>" + GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val.split("\n")[0]);
+ (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
break;
case USER : // user defined.
uprops += "\n\t<b>" +
GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val.split("\n")[0]);
+ (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
break;
case SPECIAL : // * prop| args | ctor | init
spec += "\n\t<b>" +
GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val.split("\n")[0]);
+ (val.length > 0 ? GLib.Markup.escape_text(val.split("\n")[0]) : "");
break;
case LISTENER : return ""; // always raw...
///n.toValaName(file.tree);
- GLib.debug("top cls %s / xlcs %s\n ",file.tree.xvala_cls,file.tree.xvala_cls);
+ //GLib.debug("top cls %s / xlcs %s ",file.tree.xvala_cls,file.tree.xvala_cls);
//n.cls = file.tree.xvala_cls;
//n.xcls = file.tree.xvala_xcls;
return n.munge();
public Editor editor;
//public WindowState windowstate;
public CompletionModel model;
- global::Gtk.StringFilter filter;
+ global::Gtk.StringFilter? filter = null;
public CompletionProvider(Editor editor)
{
return 200;
}
+
+ public bool is_trigger(global::Gtk.TextIter iter, unichar ch)
+ {
+ if (this.in_populate || ch == 32) {
+ return false;
+ }
+ GLib.debug("should trigger? %c", (int) ch);
+
+
+ return true;
+ }
+
public void activate (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal)
{
GLib.debug("compelte activate");
internal async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable)
{
GLib.debug("pupoulate async");
- /*if (!this.in_populate) {
+ var ret = new GLib.ListStore(typeof(CompletionProposal));
+
+ if (this.in_populate) {
GLib.debug("pupoulate async - skipped waiting for reply");
- return null;
+ return ret;
}
this.in_populate = true;
-*/
+
global::Gtk.TextIter begin, end;
Lsp.CompletionList res;
if (context.get_bounds (out begin, out end)) {
offset += 2;
}
}
-
+ // this should not really be slow, as it's a quick repsonse
yield this.file.getLanguageServer().document_change_force(this.file, this.editor.tempFileContents());
try {
GLib.debug("sending request to language server %s", this.file.getLanguageServer().get_type().name());
res = yield this.file.getLanguageServer().completion(this.file, line, offset, 1);
} catch (GLib.Error e) {
GLib.debug("got error %s", e.message);
- res = null;
+ this.in_populate = false;
+ return ret;
}
} else {
- res = null;
+ this.in_populate = false;
+ return ret;
}
GLib.debug("pupoulate async - got reply");
{
//GLib.debug("pupoulate refilter");
-
+ if (this.filter == null) {
+ return;
+ }
var word = context.get_word();
this.filter.set_search(word);
var fqn = in_fqn;
// swap Gtk.Source* to GtkSource.
- GLib.debug("Gir.factoryFqn search %s", fqn);
+ //GLib.debug("Gir.factoryFqn search %s", fqn);
var bits = fqn.split(".");
if (bits.length < 1) {
- GLib.debug("Gir.factoryFqn fail - missing '.'");
+ //GLib.debug("Gir.factoryFqn fail - missing '.'");
return null;
}
var f = (GirObject)factory(project , bits[0]);
if (bits.length == 1 || f ==null) {
- GLib.debug("Gir.factoryFqn fail - factory failed to load NS");
+ //GLib.debug("Gir.factoryFqn fail - factory failed to load NS");
return f;
}
- GLib.debug("Gir.factoryFqn fetching child %s", fqn.substring(bits[0].length+1));
+ //GLib.debug("Gir.factoryFqn fetching child %s", fqn.substring(bits[0].length+1));
return f.fetchByFqn(fqn.substring(bits[0].length+1)); // since classes are stored in fqn format...?
public GirObject? fetchByFqn(string fqn) {
- GLib.debug("Searching (%s)%s for %s\n", this.nodetype, this.name, fqn);
+ // GLib.debug("Searching (%s)%s for %s", this.nodetype, this.name, fqn);
var bits = fqn.split(".");
var ret = this.classes.get(bits[0]);
ACCEPT,
DIAG,
+ DIAG_END,
OPEN,
SAVE,
CLOSE,
if (this.change_queue_file == null) {
return true;
}
+ if (this.getting_diagnostics) {
+ return true;
+ }
this.countdown--;
+
+
if (this.countdown < 0){
this.document_change_force.begin(this.change_queue_file, this.change_queue_file_source, (o, res) => {
this.document_change_force.end(res);
return a.path == b.path;
});
this.initialized = true;
+ this.getting_diagnostics = false;
return;
} catch (GLib.Error e) {
GLib.debug ("LS replied with error %s", e.message);
if (this.launcher == null) {
return;
}
+ this.getting_diagnostics = false;
this.in_close = true;
GLib.debug("onClose called");
}
+ bool getting_diagnostics = false;
/***
*/
{
//GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
var dg = Json.gobject_deserialize (typeof (Lsp.Diagnostics), Json.gvariant_serialize (return_value)) as Lsp.Diagnostics;
+ GLib.debug("got diag for %s", dg.filename);
this.log(LanguageClientAction.DIAG, dg.filename);
+ if (this.project.path == dg.filename) {
+ this.getting_diagnostics = false;
+ this.log(LanguageClientAction.DIAG_END, "diagnostics done");
+ return;
+
+ }
+ this.getting_diagnostics =true;
var f = this.project.getByPath(dg.filename);
if (f == null) {
//GLib.debug("no file %s", dg.uri);
var exe = GLib.Environment.find_program_in_path( "meson");
string[] args = { exe ,"setup", "build", "--prefix=/usr" };
GLib.debug("running meson");
- this.spawn = new Spawn(this.project.path , args);
+ try {
+ this.spawn = new Spawn(this.project.path , args);
+ } catch (GLib.Error e) {
+ return -1;
+ }
this.spawn.output_line.connect(( str) => {
this.onOutput(str);
});
}
var exe = GLib.Environment.find_program_in_path( "ninja");
string[] args = { exe };
-
- this.spawn = new Spawn(this.project.path + "/build" , args);
+ try {
+ this.spawn = new Spawn(this.project.path + "/build" , args);
+ } catch (GLib.Error e) {
+ return -1;
+ }
this.spawn.output_line.connect(( str) => {
this.onOutput(str);
});
}
gr += "</gresources>\n";
- FileUtils.set_contents(this.project.path + "/resources/gresources.xml", gr, gr.length);
+ try {
+ FileUtils.set_contents(this.project.path + "/resources/gresources.xml", gr, gr.length);
+ } catch (GLib.Error e) {
+ return "";
+ }
+
+
this.has_resources = true;
c_name: '" + this.project.name + "_resources'
)";
-
- return "";
+
}
this.complete.connect( (res, str, stderr) => {
loop.quit ();
});
+ try {
+ this.run();
+ } catch (GLib.Error e) {
+ return -1;
+ }
- this.run();
loop.run ();
return this.result;