@@ -13,12 +13,13 @@ namespace ts {
13
13
}
14
14
15
15
export function getSourceMapper (
16
- getCanonicalFileName : GetCanonicalFileName ,
16
+ useCaseSensitiveFileNames : boolean ,
17
17
currentDirectory : string ,
18
18
log : ( message : string ) => void ,
19
19
host : LanguageServiceHost ,
20
20
getProgram : ( ) => Program ,
21
21
) : SourceMapper {
22
+ const getCanonicalFileName = createGetCanonicalFileName ( useCaseSensitiveFileNames ) ;
22
23
let sourcemappedFileCache : SourceFileLikeCache ;
23
24
return { tryGetOriginalLocation, tryGetGeneratedLocation, toLineColumnOffset, clearCache } ;
24
25
@@ -56,6 +57,7 @@ namespace ts {
56
57
return file . sourceMapper = sourcemaps . decode ( {
57
58
readFile : s => host . readFile ! ( s ) , // TODO: GH#18217
58
59
fileExists : s => host . fileExists ! ( s ) , // TODO: GH#18217
60
+ useCaseSensitiveFileNames,
59
61
getCanonicalFileName,
60
62
log,
61
63
} , mapFileName , maps , getProgram ( ) , sourcemappedFileCache ) ;
@@ -105,7 +107,11 @@ namespace ts {
105
107
106
108
function tryGetGeneratedLocation ( info : sourcemaps . SourceMappableLocation ) : sourcemaps . SourceMappableLocation | undefined {
107
109
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 ) ;
109
115
if ( declarationPath === undefined ) return undefined ;
110
116
const declarationFile = getFile ( declarationPath ) ;
111
117
if ( ! declarationFile ) return undefined ;
0 commit comments