@@ -6997,8 +6997,12 @@ namespace ts {
6997
6997
* Checks if position points to a valid position to add JSDoc comments, and if so,
6998
6998
* returns the appropriate template. Otherwise returns an empty string.
6999
6999
* 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
7002
7006
*
7003
7007
* Hosts should ideally check that:
7004
7008
* - The line is all whitespace up to 'position' before performing the insertion.
@@ -7041,7 +7045,9 @@ namespace ts {
7041
7045
case SyntaxKind . SourceFile :
7042
7046
return undefined ;
7043
7047
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 { }'.
7045
7051
if ( commentOwner . parent . kind === SyntaxKind . ModuleDeclaration ) {
7046
7052
return undefined ;
7047
7053
}
0 commit comments