Autocompletion for member functions parameters Follow
It's taken me a while to figure it out, but I now have autocomplete working for variables and global functions parameters using explicit JSDoc. But I don't seem to be able to figure out how to get it working for member function parameters.
See my example below. I am using dojo.describe, but assume its a more generic issue (and don't know what other type declaration approaches that WS understands to test them). In my example all of these work:
- @type tag on a variable (varDude)
- code inspection (inferredDude)
- @param tag on a global function parameter (paramDude)
- @return tag on global function (globalMethod) or member function (memberMethod)
However, I can't get @param tag to work on a member function parameter (memberParamDude). If I do a Ctrl-Q on memberParamDude it does show the parameter name (vs "no documentation found"), so its seeing the @param tag just not figuring out the type. As I mentioned above the @return tag works for memberMethod also so its doing some JSDoc type processing.
d
PS, Suggestion - I've noticed that Ctrl-Q shows nothing for variables that are inferred (inferredDude), it would be nice if it showed what WS has guessed the type is.
dojo.declare("Person", null, {
constructor: function(name, age, currentResidence) {
this.currentResidence = currentResidence;
},
moveToNewState: function(newState) {
this.currentResidence = newState;
},
/**
* @param Person memberParamDude
* @return Person
*/
memberMethod: function(memberParamDude) {
memberParamDude.currentResidence; // autocompletes generically
}
});
/** @type Person */
var varDude;
varDude.currentResidence; // autocompletes as Person
var inferredDude = new Person("phiggins", 28, "Tennessee");
inferredDude.currentResidence; // autocompletes as Person
/**
* @param Person paramDude This is some param description
* @return Person A whole new dude
*/
function globalMethod(paramDude) {
paramDude.currentResidence; // autocompletes as Person
}
globalMethod(varDude).currentResidence; // autocompletes as Person
varDude.memberMethod(varDue).currentResidence; // autocompletes as Person
Please sign in to leave a comment.
With no replies I am assuming this is a bug - http://youtrack.jetbrains.net/issue/WI-4680.
Please surround parameter type with braces
Great, that does it. The fact you don't do that for @type tricked me up. Thanks!
For others reading this thread, the change is as follows:
or inline works also:
Thanks,
dave
PS, I ran into two other related issues. I can't seem to get autocomplete to work across files and it seems that JS autocomplete not always updated right away on JSDoc/comment changes.
PS II, Sorry for all the edits getting the post right, I wanted to make sure it was accurate for others trying to make autocomplete work.