microsoft / microsoft/TypeScript

jsDoc intellisense support for @augments/@extends

Aperta
#30,943 1 commento 37 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Domain: JavaScript Domain: JSDoc Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando come vengono rappresentate le annotazioni @extends e @augments di JSDoc e come IntelliSense raccoglie i membri del tipo utilizzato. Usa gli esempi FileBase e StyleFile presenti in questa issue per riprodurre le proprietà di prototype e proprie mancanti, quindi verifica che i membri ereditati vengano visualizzati senza compromettere i suggerimenti esistenti per i membri del tipo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
compilers, developer-experience
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.