Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

No code hints for 'this' when superclass is unknown #6929

Open
peterflynn opened this issue Feb 20, 2014 · 0 comments
Open

No code hints for 'this' when superclass is unknown #6929

peterflynn opened this issue Feb 20, 2014 · 0 comments

Comments

@peterflynn
Copy link
Member

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 () {
    };
});
  1. Put the cursor in any of the function bodies
  2. 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants