@@ -1770,14 +1770,15 @@ namespace ts.Completions {
17701770 if ( tag . tagName . pos <= position && position <= tag . tagName . end ) {
17711771 return { kind : CompletionDataKind . JsDocTagName } ;
17721772 }
1773- if ( isTagWithTypeExpression ( tag ) && tag . typeExpression && tag . typeExpression . kind === SyntaxKind . JSDocTypeExpression ) {
1773+ const typeExpression = tryGetTypeExpressionFromTag ( tag ) ;
1774+ if ( typeExpression ) {
17741775 currentToken = getTokenAtPosition ( sourceFile , position ) ;
17751776 if ( ! currentToken ||
17761777 ( ! isDeclarationName ( currentToken ) &&
17771778 ( currentToken . parent . kind !== SyntaxKind . JSDocPropertyTag ||
17781779 ( currentToken . parent as JSDocPropertyTag ) . name !== currentToken ) ) ) {
17791780 // Use as type location if inside tag's type expression
1780- insideJsDocTagTypeExpression = isCurrentlyEditingNode ( tag . typeExpression ) ;
1781+ insideJsDocTagTypeExpression = isCurrentlyEditingNode ( typeExpression ) ;
17811782 }
17821783 }
17831784 if ( ! insideJsDocTagTypeExpression && isJSDocParameterTag ( tag ) && ( nodeIsMissing ( tag . name ) || tag . name . pos <= position && position <= tag . name . end ) ) {
@@ -2046,7 +2047,7 @@ namespace ts.Completions {
20462047 hasUnresolvedAutoImports,
20472048 } ;
20482049
2049- type JSDocTagWithTypeExpression = JSDocParameterTag | JSDocPropertyTag | JSDocReturnTag | JSDocTypeTag | JSDocTypedefTag ;
2050+ type JSDocTagWithTypeExpression = JSDocParameterTag | JSDocPropertyTag | JSDocReturnTag | JSDocTypeTag | JSDocTypedefTag | JSDocTemplateTag ;
20502051
20512052 function isTagWithTypeExpression ( tag : JSDocTag ) : tag is JSDocTagWithTypeExpression {
20522053 switch ( tag . kind ) {
@@ -2056,11 +2057,21 @@ namespace ts.Completions {
20562057 case SyntaxKind . JSDocTypeTag :
20572058 case SyntaxKind . JSDocTypedefTag :
20582059 return true ;
2060+ case SyntaxKind . JSDocTemplateTag :
2061+ return ! ! ( tag as JSDocTemplateTag ) . constraint ;
20592062 default :
20602063 return false ;
20612064 }
20622065 }
20632066
2067+ function tryGetTypeExpressionFromTag ( tag : JSDocTag ) : JSDocTypeExpression | undefined {
2068+ if ( isTagWithTypeExpression ( tag ) ) {
2069+ const typeExpression = isJSDocTemplateTag ( tag ) ? tag . constraint : tag . typeExpression ;
2070+ return typeExpression && typeExpression . kind === SyntaxKind . JSDocTypeExpression ? typeExpression : undefined ;
2071+ }
2072+ return undefined ;
2073+ }
2074+
20642075 function getTypeScriptMemberSymbols ( ) : void {
20652076 // Right of dot member completion list
20662077 completionKind = CompletionKind . PropertyAccess ;
0 commit comments