@@ -1448,32 +1448,15 @@ namespace ts {
1448
1448
const symbol = getSymbolAtLocationForQuickInfo ( node , typeChecker ) ;
1449
1449
1450
1450
if ( ! symbol || typeChecker . isUnknownSymbol ( symbol ) ) {
1451
- // Try getting just type at this position and show
1452
- switch ( node . kind ) {
1453
- case SyntaxKind . Identifier :
1454
- if ( isLabelName ( node ) ) {
1455
- // Type here will be 'any', avoid displaying this.
1456
- return undefined ;
1457
- }
1458
- // falls through
1459
- case SyntaxKind . PropertyAccessExpression :
1460
- case SyntaxKind . QualifiedName :
1461
- case SyntaxKind . ThisKeyword :
1462
- case SyntaxKind . ThisType :
1463
- case SyntaxKind . SuperKeyword :
1464
- // For the identifiers/this/super etc get the type at position
1465
- const type = typeChecker . getTypeAtLocation ( node ) ;
1466
- return type && {
1467
- kind : ScriptElementKind . unknown ,
1468
- kindModifiers : ScriptElementKindModifier . none ,
1469
- textSpan : createTextSpanFromNode ( node , sourceFile ) ,
1470
- displayParts : typeChecker . runWithCancellationToken ( cancellationToken , typeChecker => typeToDisplayParts ( typeChecker , type , getContainerNode ( node ) ) ) ,
1471
- documentation : type . symbol ? type . symbol . getDocumentationComment ( typeChecker ) : undefined ,
1472
- tags : type . symbol ? type . symbol . getJsDocTags ( ) : undefined
1473
- } ;
1474
- }
1475
-
1476
- return undefined ;
1451
+ const type = shouldGetType ( sourceFile , node , position ) ? typeChecker . getTypeAtLocation ( node ) : undefined ;
1452
+ return type && {
1453
+ kind : ScriptElementKind . unknown ,
1454
+ kindModifiers : ScriptElementKindModifier . none ,
1455
+ textSpan : createTextSpanFromNode ( node , sourceFile ) ,
1456
+ displayParts : typeChecker . runWithCancellationToken ( cancellationToken , typeChecker => typeToDisplayParts ( typeChecker , type , getContainerNode ( node ) ) ) ,
1457
+ documentation : type . symbol ? type . symbol . getDocumentationComment ( typeChecker ) : undefined ,
1458
+ tags : type . symbol ? type . symbol . getJsDocTags ( ) : undefined
1459
+ } ;
1477
1460
}
1478
1461
1479
1462
const { symbolKind, displayParts, documentation, tags } = typeChecker . runWithCancellationToken ( cancellationToken , typeChecker =>
@@ -1489,6 +1472,23 @@ namespace ts {
1489
1472
} ;
1490
1473
}
1491
1474
1475
+ function shouldGetType ( sourceFile : SourceFile , node : Node , position : number ) : boolean {
1476
+ switch ( node . kind ) {
1477
+ case SyntaxKind . Identifier :
1478
+ return ! isLabelName ( node ) ;
1479
+ case SyntaxKind . PropertyAccessExpression :
1480
+ case SyntaxKind . QualifiedName :
1481
+ // Don't return quickInfo if inside the comment in `a/**/.b`
1482
+ return ! isInComment ( sourceFile , position ) ;
1483
+ case SyntaxKind . ThisKeyword :
1484
+ case SyntaxKind . ThisType :
1485
+ case SyntaxKind . SuperKeyword :
1486
+ return true ;
1487
+ default :
1488
+ return false ;
1489
+ }
1490
+ }
1491
+
1492
1492
function getSymbolAtLocationForQuickInfo ( node : Node , checker : TypeChecker ) : Symbol | undefined {
1493
1493
if ( ( isIdentifier ( node ) || isStringLiteral ( node ) )
1494
1494
&& isPropertyAssignment ( node . parent )
0 commit comments