mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Add support for enums and property signatures
This commit is contained in:
parent
49772187e5
commit
976c25c672
@ -259,8 +259,6 @@ namespace ts.JsDoc {
|
||||
}
|
||||
function getCommentOwnerInfo(tokenAtPos: Node): CommentOwnerInfo | undefined {
|
||||
// TODO: add support for:
|
||||
// - enums/enum members
|
||||
// - property declarations
|
||||
// - potentially property assignments
|
||||
for (let commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {
|
||||
switch (commentOwner.kind) {
|
||||
@ -273,6 +271,9 @@ namespace ts.JsDoc {
|
||||
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.EnumMember:
|
||||
return { commentOwner };
|
||||
|
||||
case SyntaxKind.VariableStatement: {
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////*interfaceFoo*/
|
||||
////interface Foo {
|
||||
//// /*propertybar*/
|
||||
//// bar: any;
|
||||
////
|
||||
//// /*methodbaz*/
|
||||
//// baz(message: any): void;
|
||||
////}
|
||||
|
||||
verify.docCommentTemplateAt("interfaceFoo", /*expectedOffset*/ 8,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
verify.emptyDocCommentTemplateAt("propertybar");
|
||||
|
||||
verify.docCommentTemplateAt("methodbaz", /*expectedOffset*/ 12,
|
||||
`/**
|
||||
*
|
||||
* @param message
|
||||
*/`);
|
||||
@ -0,0 +1,50 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////*interfaceFoo*/
|
||||
////interface Foo {
|
||||
//// /*propertybar*/
|
||||
//// bar: any;
|
||||
////
|
||||
//// /*methodbaz*/
|
||||
//// baz(message: any): void;
|
||||
////}
|
||||
////
|
||||
/////*enumStatus*/
|
||||
////const enum Status {
|
||||
//// /*memberOpen*/
|
||||
//// Open,
|
||||
////
|
||||
//// /*memberClosed*/
|
||||
//// Closed
|
||||
////}
|
||||
|
||||
verify.docCommentTemplateAt("interfaceFoo", /*expectedOffset*/ 8,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("propertybar", /*expectedOffset*/ 12,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("methodbaz", /*expectedOffset*/ 12,
|
||||
`/**
|
||||
*
|
||||
* @param message
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("enumStatus", /*expectedOffset*/ 8,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("memberOpen", /*expectedOffset*/ 12,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
verify.docCommentTemplateAt("memberClosed", /*expectedOffset*/ 12,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
Loading…
x
Reference in New Issue
Block a user