microsoft / microsoft/TypeScript
JSDoc : add support for @method (and @property)
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
Search Terms
- JSDoc
@method@property- support
Suggestion
It would be great to add support for @method and @property (and maybe @memberof) now that annotations are on their way.
I found bug #15715 that only talks about @property support but I think this makes more sense to see those in a same light because they should have a very common implementation and moreover they meet the same goals as a whole. At least I think and I explain my reasoning about this below!
Use Cases
I have functions that do add methods and/or getters on a class right now, waiting for annotations to get their way in JS/TS. But let's say this: when annotations are here, those 2 flags support will be needed anyway (or at least I think so: I don't see how to make IntelliSense work without those)!
/**
* Some class
* @class
*/
class Test {
/* whatever */
}
// this adds a #foo() method on the class prototype as well as a #bar getter(/setter)
someMethodAddingABehavior(Test, ...params);
And tomorrow with annotations:
/**
* Some class
* @class
*/
@someAnnotationAddingABehavior(...params)
class Test {
/* whatever */
}
Examples
I'd like to be able to document those doing something like:
/**
* What foo is doing is great!
* @method foo
* @param {string} testParam some testing parameter
* @returns {string} some random string
* @memberof Test.prototype
*/
/**
* Bar is awesome too!
* @property {number} bar
* @memberof Test.prototype
*/
someMethodAddingABehavior(Test, ...params);
Or at least to be able to document them in the class itself:
/**
* Some class
* @class
*/
class Test {
/* whatever */
/**
* What foo is doing is great!
* @method foo
* @param {string} testParam some testing parameter
* @returns {string} some random string
*/
/**
* Bar is awesome too!
* @property {number} bar
*/
}
With support of these, I would expect vscode to suggest to me the foo method and the bar property when completing properties of a value of type Test.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
No se nombran archivos de origen ni pruebas. Empieza por localizar el procesamiento existente de las anotaciones JSDoc y la ruta utilizada para VS Code IntelliSense; después, determina cómo deberían contribuir @method y @property a los miembros de Test. La tarea estará terminada cuando los métodos y propiedades externos documentados aparezcan en el autocompletado sin cambiar el JavaScript emitido.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, typescript, vscode
- Área
- compilers, developer-experience
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100