@@ -6997,8 +6997,12 @@ namespace ts {
69976997 * Checks if position points to a valid position to add JSDoc comments, and if so,
69986998 * returns the appropriate template. Otherwise returns an empty string.
69996999 * Valid positions are
7000- * - outside of comments, statements, and expressions, and
7001- * - preceding a function declaration.
7000+ * - outside of comments, statements, and expressions, and
7001+ * - preceding a:
7002+ * - function/constructor/method declaration
7003+ * - class declarations
7004+ * - variable statements
7005+ * - namespace declarations
70027006 *
70037007 * Hosts should ideally check that:
70047008 * - The line is all whitespace up to 'position' before performing the insertion.
@@ -7041,7 +7045,9 @@ namespace ts {
70417045 case SyntaxKind . SourceFile :
70427046 return undefined ;
70437047 case SyntaxKind . ModuleDeclaration :
7044- // We don't want to give back a JSDoc for the 'b' in 'module a.b'.
7048+ // If in walking up the tree, we hit a a nested namespace declaration,
7049+ // then we must be somewhere within a dotted namespace name; however we don't
7050+ // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
70457051 if ( commentOwner . parent . kind === SyntaxKind . ModuleDeclaration ) {
70467052 return undefined ;
70477053 }
0 commit comments