Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsDoc intellisense support for @augments/@extends #30943

Open
aliemre1990 opened this issue Apr 15, 2019 · 0 comments
Open

jsDoc intellisense support for @augments/@extends #30943

aliemre1990 opened this issue Apr 15, 2019 · 0 comments
Labels
Add a Flag Any problem can be solved by flags, except for the problem of having too many flags Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Suggestion An idea for TypeScript

Comments

@aliemre1990
Copy link

Issue Type: Feature Request

Please make intellisense support @augments/@extends tags. Currently intellisense is not showing base class properties both prototype and own.

Here is my base class

const fs = require('fs');

/**
 * Used as an abstract base class for file classes.
 * @param {string} filePath Path of the file.
 */
function FileBase(filePath) {
    if (this.__proto__ === FileBase.prototype)
        throw `'FileBase' class cannot be instantiated. It's an abstract class.`;

    if (!fs.existsSync(filePath))
        throw `'filePath' doesn't point an existing file.`;

    this.filePath = filePath;

    /**
      * Stores file content. Dont directly set this property. Use resetContent method instead.
      * @type {string}
      */
    this.content = fs.readFileSync(filePath).toString();
    /**
     * Stores fs.Stats of file.
     * @type {fs.Stats}
     */
    this.stats = fs.lstatSync(filePath);
    /**@type {{content:string,stats:fs.Stats}[]} */
    this.history = [];
}

/**
 * Resets content property with current file content.
 * @returns {string} File content.
 */
FileBase.prototype.resetContent = function () {
    ...
}

module.exports = FileBase;

Example usage of base class. I tagged with @extends.

/**
 * @typedef {'module'|'layout-module'|'library'|'standalone-main'|'standalone-dependency'} StyleFileType
 */

/**
 * Represents a style file.
 * @extends FileBase
 * @constructor
 * @param {string} filePath Path of file.
 * @param {StyleFileType} fileType Type of style.
 * @param {Config} config
 */
function StyleFile(filePath, fileType, config) {
    if (!(this instanceof StyleFile)) {
        return new StyleFile(filePath, fileType, config);
    }

    /**
     * If StyleFile constructor is used to create objects, redirect object creation to child classes.
     */
    if (this.__proto__ === StyleFile.prototype) {
        switch (fileType) {
            case 'module':
                return new ModuleStyleFile(filePath, config);
            case 'layout-module':
                return new LayoutModuleStyleFile(filePath, config);
            case 'library':
                return new LibraryStyleFile(filePath, config);
            case 'standalone-dependency':
                return new StandaloneLibraryDependencyStyleFile(filePath, config);
            case 'standalone-main':
                return new StandaloneLibraryMainStyleFile(filePath, config);
            default:
                throw 'Invalid file type.';
        }
    }
    FileBase.call(this, filePath);

    this.fileType = fileType;
    this.config = config;

    /**@type {StyleFile[]} */
    this.parentFiles = null;
    /**@type {StyleFile[]} */
    this.childFiles = null;
}
StyleFile.prototype = Object.create(FileBase.prototype);

StyleFile.prototype.getImportedStylePaths = function (content) {
   .....
}

module.exports = StyleFile;

Currently it only displays members from the used type.
issue-augments-1

VS Code version: Code 1.33.0 (0dd516dd412d42323fc3464531b1c715d51c4c1a, 2019-04-04T15:14:28.026Z)
OS version: Windows_NT x64 10.0.17134

@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 15, 2019
@mjbvz mjbvz removed their assignment Apr 15, 2019
@RyanCavanaugh RyanCavanaugh added Add a Flag Any problem can be solved by flags, except for the problem of having too many flags Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Apr 16, 2019
@RyanCavanaugh RyanCavanaugh added the Suggestion An idea for TypeScript label Jul 30, 2019
@DanielRosenwasser DanielRosenwasser added Domain: JSDoc Relates to JSDoc parsing and type generation Domain: JavaScript The issue relates to JavaScript specifically labels Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add a Flag Any problem can be solved by flags, except for the problem of having too many flags Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants