- public override Gee.ArrayList<CompletionProposal> suggestComplete(
- JsRender.JsRender file,
- JsRender.Node? node,
- JsRender.NodeProp? xxxprop, // is this even used?
- string complete_string
- ) {
-
- var ret = new Gee.ArrayList<CompletionProposal>();
- return ret;
- /*
- // completion rules??
-
- // make sure data is loaded
- Gir.factory(this.project,"Gtk");
-
- // Roo......
-
- // this. (based on the node type)
- // this.xxx // Node and any determination...
-
- if (complete_string.index_of(".",0) < 0) {
- // string does not have a '.'
- // offer up vala keywords... / _this .. / look for var string = .. in the code..
-
- var max = (int)Vala.TokenType.YIELD +1;
- for (var i =0; i < max;i++) {
- var m = (Vala.TokenType)i;
- var s = m.to_string();
- var ss = s.slice(1,-1);
- if (s[0] == '`' && GLib.Regex.match_simple("^[a-z]+$", ss) &&
- complete_string != ss && ss.index_of(complete_string,0) == 0 ) {
- var sci = new CompletionProposal(ss,ss, "vala : " + ss);
- ret.add(sci);
- }
- }
- var miter = ((Project.Gtk)this.project).gir_cache.map_iterator();
- while (miter.next()) {
- var ss = miter.get_key();
-
- if (complete_string != ss && ss.index_of(complete_string,0) == 0 ) {
- var sci = new CompletionProposal(ss,ss, "vala namespace: " + ss);
- ret.add(sci);
-
- }
- }
-
-
- if (complete_string != "_this" && "_this".index_of(complete_string,0) == 0 ) { // should we ignore exact matches... ???
- var sci = new CompletionProposal("_this - the top level element","_this",
- "Reference to the container object instance of this file");
- ret.add(sci);
-
- }
- // basic types..
-
- return ret;
- }
-
-
- // got at least one ".".
- var parts = complete_string.split(".");
- var curtype = "";
- var cur_instance = false;
- if (parts[0] == "this") {
- // work out from the node, what the type is...
- if (node == null) {
- print("node is empty - no return\n");
- return ret; // no idea..
- }
- curtype = "*" + node.fqn();
- cur_instance = true;
- } else {
- if (((Project.Gtk)this.project).gir_cache.get(parts[0]) == null) {
- return ret;
- }
- curtype = parts[0];
- }
- // all Gtk.... etc.. types...
-
-
- //if (parts[0] == "Roo") {
- // curtype = "Roo";
- // cur_instance = false;
- //}
-
- var prevbits = parts[0] + ".";
- for(var i =1; i < parts.length; i++) {
- print("matching %d/%d\n", i, parts.length);
- var is_last = i == parts.length -1;
-
-
-
- // look up all the properties of the type...
- var cls = this.getClass(curtype);
- if (cls == null && curtype[0] != '*') {
- print("could not get class of curtype %s\n", curtype);
- return ret;
- }
-
- if (!is_last) {
-
- if (curtype[0] == '*' && parts[i] == "el") {
- curtype = curtype.substring(1);
- prevbits += parts[i] + ".";
- continue;
- }
-
- // only exact matches from here on...
- if (cur_instance) {
- if (cls == null) {
- return ret;
- }
- if (cls.props.has_key(parts[i])) {
- var clsprop = cls.props.get(parts[i]);
- if (clsprop.type.index_of(".",0) > -1) {
- // type is another roo object..
- curtype = clsprop.type;
- prevbits += parts[i] + ".";
- continue;
- }
- return ret;
- }
-
-
-
- // check methods?? - we do not export that at present..
- return ret; //no idea...
- }
- var look = prevbits + parts[i];
- var scls = this.getClass(look);
- if (scls == null) {
- return ret;
- }
- curtype = look;
- prevbits += parts[i] + ".";
- continue;
-
- }
-
- // got to the last element..
- print("Got last element\n");
- if (curtype == "") { // should not happen.. we would have returned already..
- return ret;
- }
- print("Got last element type %s\n",curtype);
- if (!cur_instance) {
- print("matching instance");
- // it's a static reference..
- var citer = cls.classes.map_iterator();
- while (citer.next()) {
- var scls = citer.get_key();
-
- if (parts[i].length > 0 && scls.index_of(parts[i],0) != 0) {
- continue;
- }
- // got a starting match..
- var sci = new CompletionProposal(prevbits + scls,prevbits + scls,scls);
- ret.add(sci);
-
-
- }
- // methods....
- citer = cls.methods.map_iterator();
- while (citer.next()) {
- var scls = citer.get_key();
-
- if (parts[i].length > 0 && scls.index_of(parts[i],0) != 0) {
- continue;
- }
- // got a starting match..
-
- var sci = new CompletionProposal(prevbits + scls + citer.get_value().sig,prevbits + scls,scls);
- ret.add(sci);
-
- }
-
- // enums....
- citer = cls.consts.map_iterator();
- while (citer.next()) {
- var scls = citer.get_key();
-
- if (parts[i].length > 0 && scls.index_of(parts[i],0) != 0) {
- continue;
- }
- // got a starting match..
- var sci = new CompletionProposal(prevbits + scls + citer.get_value().sig,prevbits + scls,scls);
- ret.add(sci);
-
- }
-
-
- return ret;
- }
- print("matching property");
- if (cls == null) {
- return ret;
- }
-
-
- var citer = cls.methods.map_iterator();
- while (citer.next()) {
- var cprop = citer.get_value();
- // does the name start with ...
- if (parts[i].length > 0 && cprop.name.index_of(parts[i],0) != 0) {
- continue;
- }
- // got a matching property...
- // return type?
- var sci = new CompletionProposal( cprop.name + cprop.sig + " : ("+ cprop.propertyof + ")",
- prevbits + cprop.name + "(",cprop.doctxt);
- ret.add(sci);
-
-
- }
-
- // get the properties / methods and subclasses.. of cls..
- // we have cls.. - see if the string matches any of the properties..
- citer = cls.props.map_iterator();
- while (citer.next()) {
- var cprop = citer.get_value();
- // does the name start with ...
- if (parts[i].length > 0 && cprop.name.index_of(parts[i],0) != 0) {
- continue;
- }
- // got a matching property...
- var sci = new CompletionProposal(cprop.name + " : " + cprop.type + " ("+ cprop.propertyof + ")",
- prevbits + cprop.name,cprop.doctxt);
- ret.add(sci);
-
-
-
- }
-
-
- return ret;
-
-
-
-
-
- }
-
-
-
-
-
-
- return ret;
- */
- }