@@ -300,8 +300,8 @@ namespace ts {
300
300
}
301
301
}
302
302
// For syntactic classifications, all trivia are classcified together, including jsdoc comments.
303
- // For that to work, the jsdoc comments should still be the leading trivia of the first child.
304
- // Restoring the scanner position ensures that.
303
+ // For that to work, the jsdoc comments should still be the leading trivia of the first child.
304
+ // Restoring the scanner position ensures that.
305
305
pos = this . pos ;
306
306
forEachChild ( this , processNode , processNodes ) ;
307
307
if ( pos < this . end ) {
@@ -1374,8 +1374,13 @@ namespace ts {
1374
1374
containerName : string ;
1375
1375
}
1376
1376
1377
+ export interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
1378
+ // For more complex definitions where kind and name are insufficient to properly colorize the text
1379
+ displayParts ?: SymbolDisplayPart [ ] ;
1380
+ }
1381
+
1377
1382
export interface ReferencedSymbol {
1378
- definition : DefinitionInfo ;
1383
+ definition : ReferencedSymbolDefinitionInfo ;
1379
1384
references : ReferenceEntry [ ] ;
1380
1385
}
1381
1386
@@ -6108,7 +6113,7 @@ namespace ts {
6108
6113
6109
6114
return result ;
6110
6115
6111
- function getDefinition ( symbol : Symbol ) : DefinitionInfo {
6116
+ function getDefinition ( symbol : Symbol ) : ReferencedSymbolDefinitionInfo {
6112
6117
const info = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , node . getSourceFile ( ) , getContainerNode ( node ) , node ) ;
6113
6118
const name = map ( info . displayParts , p => p . text ) . join ( "" ) ;
6114
6119
const declarations = symbol . declarations ;
@@ -6122,7 +6127,8 @@ namespace ts {
6122
6127
name,
6123
6128
kind : info . symbolKind ,
6124
6129
fileName : declarations [ 0 ] . getSourceFile ( ) . fileName ,
6125
- textSpan : createTextSpan ( declarations [ 0 ] . getStart ( ) , 0 )
6130
+ textSpan : createTextSpan ( declarations [ 0 ] . getStart ( ) , 0 ) ,
6131
+ displayParts : info . displayParts
6126
6132
} ;
6127
6133
}
6128
6134
@@ -6317,7 +6323,7 @@ namespace ts {
6317
6323
}
6318
6324
} ) ;
6319
6325
6320
- const definition : DefinitionInfo = {
6326
+ const definition : ReferencedSymbolDefinitionInfo = {
6321
6327
containerKind : "" ,
6322
6328
containerName : "" ,
6323
6329
fileName : targetLabel . getSourceFile ( ) . fileName ,
@@ -6634,14 +6640,20 @@ namespace ts {
6634
6640
getReferencesForStringLiteralInFile ( sourceFile , type , possiblePositions , references ) ;
6635
6641
}
6636
6642
6643
+ const symbol = typeChecker . getSymbolAtLocation ( node ) ;
6644
+
6645
+ const displayParts = symbol ? getSymbolDisplayPartsDocumentationAndSymbolKind (
6646
+ symbol , node . getSourceFile ( ) , getContainerNode ( node ) , node ) . displayParts : undefined ;
6647
+
6637
6648
return [ {
6638
6649
definition : {
6639
6650
containerKind : "" ,
6640
6651
containerName : "" ,
6641
6652
fileName : node . getSourceFile ( ) . fileName ,
6642
6653
kind : ScriptElementKind . variableElement ,
6643
6654
name : type . text ,
6644
- textSpan : createTextSpanFromBounds ( node . getStart ( ) , node . getEnd ( ) )
6655
+ textSpan : createTextSpanFromBounds ( node . getStart ( ) , node . getEnd ( ) ) ,
6656
+ displayParts
6645
6657
} ,
6646
6658
references : references
6647
6659
} ] ;
0 commit comments