mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Parse JSDoc comments for ES6 class constructors and methods
Fixes #6646
This commit is contained in:
@@ -4778,7 +4778,7 @@ namespace ts {
|
||||
parseExpected(SyntaxKind.ConstructorKeyword);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, Diagnostics.or_expected);
|
||||
return finishNode(node);
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, asteriskToken: Node, name: PropertyName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration {
|
||||
@@ -4792,7 +4792,7 @@ namespace ts {
|
||||
const isAsync = !!(method.flags & NodeFlags.Async);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage);
|
||||
return finishNode(method);
|
||||
return addJSDocComment(finishNode(method));
|
||||
}
|
||||
|
||||
function parsePropertyDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, name: PropertyName, questionToken: Node): ClassElement {
|
||||
|
||||
18
tests/cases/fourslash/getJavaScriptCompletions16.ts
Normal file
18
tests/cases/fourslash/getJavaScriptCompletions16.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: file.js
|
||||
//// "use strict";
|
||||
////
|
||||
//// class Something {
|
||||
////
|
||||
//// /**
|
||||
//// * @param {number} a
|
||||
//// */
|
||||
//// constructor(a, b) {
|
||||
//// a./**/
|
||||
//// }
|
||||
//// }
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains('toFixed', undefined, undefined, 'method');
|
||||
Reference in New Issue
Block a user