Skip to content

Commit e62f960

Browse files
authored
fix(47733): omit JSDoc comment template suggestion on node with existing JSDoc (#47748)
1 parent 3c6c279 commit e62f960

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/services/jsDoc.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ namespace ts.JsDoc {
353353
}
354354

355355
const { commentOwner, parameters, hasReturn } = commentOwnerInfo;
356-
if (commentOwner.getStart(sourceFile) < position) {
356+
const commentOwnerJSDoc = hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? lastOrUndefined(commentOwner.jsDoc) : undefined;
357+
if (commentOwner.getStart(sourceFile) < position || commentOwnerJSDoc && commentOwnerJSDoc !== existingDocComment) {
357358
return undefined;
358359
}
359360

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
/////** /**/ */
4+
////
5+
/////**
6+
//// * @param {string} a
7+
//// * @param {string} b
8+
//// */
9+
////function foo(a, b) {
10+
//// return a + b;
11+
////}
12+
13+
verify.noDocCommentTemplateAt("");

0 commit comments

Comments
 (0)