mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix(52517): JSDoc Comment Template not provided when unrelated JSDoc with tag exists (#54132)
This commit is contained in:
parent
8ea3887f70
commit
8db251fb47
@ -492,9 +492,7 @@ export function getDocCommentTemplateAtPosition(newLine: string, sourceFile: Sou
|
||||
// * if the caret was directly in front of the object, then we add an extra line and indentation.
|
||||
const openComment = "/**";
|
||||
const closeComment = " */";
|
||||
|
||||
// If any of the existing jsDoc has tags, ignore adding new ones.
|
||||
const hasTag = (commentOwnerJsDoc || []).some(jsDoc => !!jsDoc.tags);
|
||||
const hasTag = length(getJSDocTags(commentOwner)) > 0;
|
||||
|
||||
if (tags && !hasTag) {
|
||||
const preamble = openComment + newLine + indentationStr + " * ";
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////** @typedef {string} Id */
|
||||
////
|
||||
/////** /**/ */
|
||||
////function foo(x, y, z) {}
|
||||
|
||||
verify.docCommentTemplateAt("", 7,
|
||||
`/**
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/`);
|
||||
@ -0,0 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////** @param p */
|
||||
/////*/**/
|
||||
////function foo(p) {}
|
||||
|
||||
verify.docCommentTemplateAt("", 3, `/** */`);
|
||||
@ -9,4 +9,8 @@
|
||||
/////*/**/
|
||||
////function foo(p) {}
|
||||
|
||||
verify.docCommentTemplateAt("", 3, "/** */");
|
||||
verify.docCommentTemplateAt("", 7,
|
||||
`/**
|
||||
*
|
||||
* @param p
|
||||
*/`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user