Skip to content

Commit 7aeb11b

Browse files
Return doc comment template for interfaces and method signatures
1 parent b566480 commit 7aeb11b

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/services/jsDoc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,12 @@ namespace ts.JsDoc {
266266
case SyntaxKind.FunctionDeclaration:
267267
case SyntaxKind.MethodDeclaration:
268268
case SyntaxKind.Constructor:
269-
const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration;
269+
case SyntaxKind.MethodSignature:
270+
const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature;
270271
return { commentOwner, parameters };
271272

272273
case SyntaxKind.ClassDeclaration:
274+
case SyntaxKind.InterfaceDeclaration:
273275
return { commentOwner };
274276

275277
case SyntaxKind.VariableStatement: {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
/////*interfaceFoo*/
4+
////interface Foo {
5+
//// /*propertybar*/
6+
//// bar: any;
7+
////
8+
//// /*methodbaz*/
9+
//// baz(message: any): void;
10+
////}
11+
12+
verify.docCommentTemplateAt("interfaceFoo", /*expectedOffset*/ 8,
13+
`/**
14+
*
15+
*/`);
16+
17+
verify.emptyDocCommentTemplateAt("propertybar");
18+
19+
verify.docCommentTemplateAt("methodbaz", /*expectedOffset*/ 12,
20+
`/**
21+
*
22+
* @param message
23+
*/`);

0 commit comments

Comments
 (0)