- static DialogConfirm _DialogConfirm;
-
- public class DialogConfirm : Object
- {
- public Gtk.MessageDialog el;
- private DialogConfirm _this;
-
- public static DialogConfirm singleton()
- {
- if (_DialogConfirm == null) {
- _DialogConfirm= new DialogConfirm();
- }
- return _DialogConfirm;
- }
-
- // my vars (def)
-
- // ctor
- public DialogConfirm()
- {
- _this = this;
- this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Test" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Please Confirm ";
- this.el.name = "DialogConfirm";
- this.el.modal = true;
- this.el.use_markup = true;
-
- //listeners
- this.el.close_request.connect( (event) => {
- this.el.response(Gtk.ResponseType.CANCEL);
- this.el.hide();
- return true;
-
- });
- }
-
- // user defined functions
- public void showIt // caller needs to connect to the response - to get the result.
-
- (string title, string msg) {
- //if (!this.el) { this.init(); }
- //this.success = success;
- this.el.title = title;
- this.el.text = msg;
- this.el.show();
-
-
- }
- }
+static DialogConfirm _DialogConfirm;
+
+public class DialogConfirm : Object
+{
+ public Gtk.MessageDialog el;
+ private DialogConfirm _this;
+
+ public static DialogConfirm singleton()
+ {
+ if (_DialogConfirm == null) {
+ _DialogConfirm= new DialogConfirm();
+ }
+ return _DialogConfirm;
+ }
+
+ // my vars (def)
+
+ // ctor
+ public DialogConfirm()
+ {
+ _this = this;
+ this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Test" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.title = "Please Confirm ";
+ this.el.name = "DialogConfirm";
+ this.el.modal = true;
+ this.el.use_markup = true;
+
+ //listeners
+ this.el.close_request.connect( (event) => {
+ this.el.response(Gtk.ResponseType.CANCEL);
+ this.el.hide();
+ return true;
+
+ });
+ }
+
+ // user defined functions
+ public void showIt // caller needs to connect to the response - to get the result.
+
+ (string title, string msg) {
+ //if (!this.el) { this.init(); }
+ //this.success = success;
+ this.el.title = title;
+ this.el.text = msg;
+ this.el.show();
+
+
+ }
+}
var offset = end.get_line_offset();
if (this.editor.prop != null) {
// tried line -1 (does not work)
-
+ GLib.debug("node pad = '%s' %d", this.editor.node.node_pad, this.editor.node.node_pad.length);
+
line += this.editor.prop.start_line ;
// this is based on Gtk using tabs (hence 1/2 chars);
- offset += this.editor.file.file_namespace == "" ? 1 : 2;
+ offset += this.editor.node.node_pad.length;
+ // javascript listeners are indented 2 more spaces.
+ if (this.editor.prop.ptype == JsRender.NodePropType.LISTENER) {
+ offset += 2;
+ }
}
this.file.getLanguageServer().document_change_force(this.file, this.editor.tempFileContents());
GLib.debug("got file %s : MISSING ", file.path);
return ret;
}
- GLib.debug("got file %s : %s ", file.path, this.file_contents.get(file.path));
+ //GLib.debug("got file %s : %s ", file.path, this.file_contents.get(file.path));
var ar = this.file_contents.get(file.path).split("\n");
var ln = line >= ar.length ? "" : ar[line-1];
- if (offset >= ln.length) {
- GLib.debug("request for complete on line %d > file length %d", offset, (int) ln.length);
+ if (offset-1 >= ln.length) {
+ GLib.debug("request for complete on line %d @ pos %d > line length %d", line, offset, (int) ln.length);
return ret;
}
GLib.debug("got Line %d:%d '%s' ", line, offset, ln);
var start = -1;
- for (var i = offset -1; i > 0; i--) {
- GLib.debug("check char %d '%c'", i, ln[i]);
- if (ln[i].isalpha() || ln[i] == '.') {
+ for (var i = offset - 1; i > 0; i--) {
+ GLib.debug("check char %d '%c'", i, ln[i]);
+ if (ln[i].isalpha() || ln[i] == '.' || ln[i] == '_') { // any other allowed chars?
start = i;
continue;
}
var parts = complete_string.split(".");
var curtype = "";
var cur_instance = false;
+ if (parts[0] == "_this") {
+ if (file.tree == null) {
+
+ GLib.debug("file has no tree");
+ return ret; // no idea..
+ }
+ curtype = file.tree.fqn();
+ cur_instance = true;
+ // work out from the node, what the type is...
+ // fetch node from element.
+
+ //curtype = node.fqn();
+ cur_instance = true;
+ }
+
+
if (parts[0] == "this") {
// work out from the node, what the type is...
// fetch node from element.
- //if (node == null) {
- GLib.debug("node is empty - no return\n");
+ var node = file.lineToNode(line -1); // hopefuly
+ if (node == null) {
+ GLib.debug("could nt find scope for 'this'");
return ret; // no idea..
- //}
- //curtype = node.fqn();
- //cur_instance = true;
+ }
+ curtype = node.fqn();
+ cur_instance = true;
}
if (parts[0] == "Roo") {
curtype = "Roo";
// look up all the properties of the type...
var cls = this.project.palete.getClass(curtype);
if (cls == null) {
- GLib.debug("could not get class of curtype %s\n", curtype);
+ GLib.debug("could not get class of curtype '%s'\n", curtype);
return ret;
}
// got a matching property...
// return type?
- var sci = new Lsp.CompletionItem.keyword( prevbits + prop.name + "(", prop.name + "(" , prop.doctxt );
+ var sci = new Lsp.CompletionItem.keyword( prop.name + "(", prop.name + "(" , prop.doctxt );
ret.items.add(sci);
while (citer.next()) {
var prop = citer.get_value();
// does the name start with ...
- if (parts[i].length > 0 && prop.name.index_of(parts[i],0) != 0) {
- continue;
- }
+ //if (parts[i].length > 0 && prop.name.index_of(parts[i],0) != 0) {
+ // continue;
+ //}
- var sci = new Lsp.CompletionItem.keyword( prevbits + prop.name + "(", prop.name + "(" , prop.doctxt );
+ var sci = new Lsp.CompletionItem.keyword( prop.name, prop.name , prop.doctxt );
ret.items.add(sci);