@@ -1600,10 +1600,10 @@ namespace ts {
16001600
16011601 function makeGetTargetOfMappedPosition < TIn > (
16021602 extract : ( original : TIn ) => sourcemaps . SourceMappableLocation ,
1603- create : ( result : sourcemaps . SourceMappableLocation , original : TIn ) => TIn
1603+ create : ( result : sourcemaps . SourceMappableLocation , unmapped : TIn , original : TIn ) => TIn
16041604 ) {
16051605 return getTargetOfMappedPosition ;
1606- function getTargetOfMappedPosition ( input : TIn ) : TIn {
1606+ function getTargetOfMappedPosition ( input : TIn , original = input ) : TIn {
16071607 const info = extract ( input ) ;
16081608 if ( endsWith ( info . fileName , Extension . Dts ) ) {
16091609 let file : SourceFileLike = program . getSourceFile ( info . fileName ) ;
@@ -1617,15 +1617,15 @@ namespace ts {
16171617 const mapper = getSourceMapper ( info . fileName , file ) ;
16181618 const newLoc = mapper . getOriginalPosition ( info ) ;
16191619 if ( newLoc === info ) return input ;
1620- return getTargetOfMappedPosition ( create ( newLoc , input ) ) ;
1620+ return getTargetOfMappedPosition ( create ( newLoc , input , original ) , original ) ;
16211621 }
16221622 return input ;
16231623 }
16241624 }
16251625
16261626 const getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition (
16271627 ( info : DefinitionInfo ) => ( { fileName : info . fileName , position : info . textSpan . start } ) ,
1628- ( newLoc , info ) => ( {
1628+ ( newLoc , info , original ) => ( {
16291629 containerKind : info . containerKind ,
16301630 containerName : info . containerName ,
16311631 fileName : newLoc . fileName ,
@@ -1634,12 +1634,14 @@ namespace ts {
16341634 textSpan : {
16351635 start : newLoc . position ,
16361636 length : info . textSpan . length
1637- }
1637+ } ,
1638+ originalFileName : original . fileName ,
1639+ originalTextSpan : original . textSpan
16381640 } )
16391641 ) ;
16401642
16411643 function getTargetOfMappedDeclarationFiles ( infos : ReadonlyArray < DefinitionInfo > ) : DefinitionInfo [ ] {
1642- return map ( infos , getTargetOfMappedDeclarationInfo ) ;
1644+ return map ( infos , d => getTargetOfMappedDeclarationInfo ( d ) ) ;
16431645 }
16441646
16451647 /// Goto definition
@@ -1678,12 +1680,14 @@ namespace ts {
16781680 textSpan : {
16791681 start : newLoc . position ,
16801682 length : info . textSpan . length
1681- }
1683+ } ,
1684+ originalFileName : info . fileName ,
1685+ originalTextSpan : info . textSpan
16821686 } )
16831687 ) ;
16841688
16851689 function getTargetOfMappedImplementationLocations ( infos : ReadonlyArray < ImplementationLocation > ) : ImplementationLocation [ ] {
1686- return map ( infos , getTargetOfMappedImplementationLocation ) ;
1690+ return map ( infos , d => getTargetOfMappedImplementationLocation ( d ) ) ;
16871691 }
16881692
16891693 function getImplementationAtPosition ( fileName : string , position : number ) : ImplementationLocation [ ] {
0 commit comments