PDA

View Full Version : [OPEN] WebStorm Plugin - Completion suggests method, yet IDE has "unresolved function".



Jeremy Kwiatkowski
24 Jul 2015, 9:26 AM
(This happens in some other circumstances -- which I have not been able to pin down). But, below is an excerpt from a function (in a class implementing a proxy) which takes one parameter: operation, which is documented as so:


* @param {Ext.data.operation.Operation} operation The operation being performed
If you look closely at the getScope() call, you'll see that it is underlined, and WebStorm is complaining: "Unresolved function or method: getScope()". Yet, you can also
see from the completion on the line just below, that getScope(). How can getScope() both be recognized by the completer, yet still be complained about?

52915

Makes no difference if I move anything around -- Here it is immediately at the top of the function:
52916
If I select the Ext.data.operation.Operation text and use the Goto -> Declaration context menu, it takes me right to the Ext.define for Ext.data.operation.Operation.

Jeremy

Jeremy Kwiatkowski
27 Jul 2015, 5:45 AM
/**
* Seems like we get the "Unresolved function or method" warning for the functions
* associated with config options?
*/
Ext.define('SomeClass', {

/**
* Some description
*
* @param {Ext.data.operation.Operation} operation The operation being performed
*/
doRequest: function(operation) {
var scope, canWrite;
scope = operation.getScope(); // This one has the "Unresolved function or method" warning
canWrite = operation.allowWrite(); // This one does not
}
});

Chris.OBrien
12 Aug 2015, 6:37 AM
Jeremy, thanks for the input.

This is happening because the methods like .getScope() and .getResultSet() aren't true functions on the Ext.data.operation.Operation class. They are in the class's config block, which Ext JS twists into getters/setters. So when JetBrains' JavaScript parsing looks to see if a method is valid or not, it can't find it.

This is why it works for methods like .allowWrite() or .isStarted() because they are true functions in the Operation class.

This might be something our plugin would be able to override, or at least hide the warning that .getScope() is an "Unresolved function or method". We'll have to do some research and see where we can go from there. I'll enter a ticket in our system to add it to our backlog for potential future consideration.