You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is copied over from Brackets#6929. This is reproducible on the Tern demo page.
Start with this code:
define(function (require, exports, module) {
"use strict";
function MyClass() {
}
MyClass.prototype = Object.create(Superclass.prototype);
MyClass.prototype.constructor = MyClass;
MyClass.prototype.parentClass = Superclass.prototype;
MyClass.prototype.func1 = function () {
};
MyClass.prototype.func2 = function () {
};
MyClass.prototype.func3 = function () {
};
});
Put the cursor in any of the function bodies
Type this.
Result: hints have no suggestions other than generic italic ones
Expected: even if the superclass is unknown, it should at least be able to hint the three known members func1 through func3. Because of the prototype chaining order, there's no way the nature of the superclass prototype could affect those properties.
This has been true as long as the Tern-based code hints have existed, afaict.
One real-world use case is writing extensions that subclass a core Brackets class (e.g. InlineWidget) -- because we don't grok brackets.getModule() references, the superclass will always be unknown.
The text was updated successfully, but these errors were encountered:
Logically, the tool could deduce the fact that those properties will be there, yes. But this is not a logic engine--it has its algorithmic approach to creating a type graph, which requires a type to track properties. In this case, Object.create is waiting for some kind of type to flow into its argument, so that it can create an object based on it.
I've seen similar cases (without Object.create) where a missing type would prevent propagations that would, on the surface, seem trivial. I'll see if I can find a hack to make this work better. The main problem is that, if a later file does introduce SuperClass, we don't end up confused.
Because of limitations in how Brackets' code hints deals with large numbers of files, this case comes up fairly often. We're looking to improve how Brackets deals with the files, but it would be great if there was a hack to make this better.
This is copied over from Brackets#6929. This is reproducible on the Tern demo page.
Start with this code:
this.
Result: hints have no suggestions other than generic italic ones
Expected: even if the superclass is unknown, it should at least be able to hint the three known members
func1
throughfunc3
. Because of the prototype chaining order, there's no way the nature of the superclass prototype could affect those properties.This has been true as long as the Tern-based code hints have existed, afaict.
One real-world use case is writing extensions that subclass a core Brackets class (e.g. InlineWidget) -- because we don't grok
brackets.getModule()
references, the superclass will always be unknown.The text was updated successfully, but these errors were encountered: