@@ -13,12 +13,13 @@ namespace ts {
1313 }
1414
1515 export function getSourceMapper (
16- getCanonicalFileName : GetCanonicalFileName ,
16+ useCaseSensitiveFileNames : boolean ,
1717 currentDirectory : string ,
1818 log : ( message : string ) => void ,
1919 host : LanguageServiceHost ,
2020 getProgram : ( ) => Program ,
2121 ) : SourceMapper {
22+ const getCanonicalFileName = createGetCanonicalFileName ( useCaseSensitiveFileNames ) ;
2223 let sourcemappedFileCache : SourceFileLikeCache ;
2324 return { tryGetOriginalLocation, tryGetGeneratedLocation, toLineColumnOffset, clearCache } ;
2425
@@ -56,6 +57,7 @@ namespace ts {
5657 return file . sourceMapper = sourcemaps . decode ( {
5758 readFile : s => host . readFile ! ( s ) , // TODO: GH#18217
5859 fileExists : s => host . fileExists ! ( s ) , // TODO: GH#18217
60+ useCaseSensitiveFileNames,
5961 getCanonicalFileName,
6062 log,
6163 } , mapFileName , maps , getProgram ( ) , sourcemappedFileCache ) ;
@@ -105,7 +107,11 @@ namespace ts {
105107
106108 function tryGetGeneratedLocation ( info : sourcemaps . SourceMappableLocation ) : sourcemaps . SourceMappableLocation | undefined {
107109 const program = getProgram ( ) ;
108- const declarationPath = getDeclarationEmitOutputFilePathWorker ( info . fileName , program . getCompilerOptions ( ) , currentDirectory , program . getCommonSourceDirectory ( ) , getCanonicalFileName ) ;
110+ const options = program . getCompilerOptions ( ) ;
111+ const outPath = options . outFile || options . out ;
112+ const declarationPath = outPath ?
113+ removeFileExtension ( outPath ) + Extension . Dts :
114+ getDeclarationEmitOutputFilePathWorker ( info . fileName , program . getCompilerOptions ( ) , currentDirectory , program . getCommonSourceDirectory ( ) , getCanonicalFileName ) ;
109115 if ( declarationPath === undefined ) return undefined ;
110116 const declarationFile = getFile ( declarationPath ) ;
111117 if ( ! declarationFile ) return undefined ;
0 commit comments