@@ -1632,7 +1632,7 @@ module ts {
1632
1632
private fileNameToEntry : Map < HostFileInformation > ;
1633
1633
private _compilationSettings : CompilerOptions ;
1634
1634
1635
- constructor ( private host : LanguageServiceHost ) {
1635
+ constructor ( private host : LanguageServiceHost , private getCanonicalFileName : ( fileName : string ) => string ) {
1636
1636
// script id => script index
1637
1637
this . fileNameToEntry = { } ;
1638
1638
@@ -1650,6 +1650,10 @@ module ts {
1650
1650
return this . _compilationSettings ;
1651
1651
}
1652
1652
1653
+ private normalizeFileName ( fileName : string ) : string {
1654
+ return this . getCanonicalFileName ( normalizeSlashes ( fileName ) ) ;
1655
+ }
1656
+
1653
1657
private createEntry ( fileName : string ) {
1654
1658
let entry : HostFileInformation ;
1655
1659
let scriptSnapshot = this . host . getScriptSnapshot ( fileName ) ;
@@ -1661,15 +1665,15 @@ module ts {
1661
1665
} ;
1662
1666
}
1663
1667
1664
- return this . fileNameToEntry [ normalizeSlashes ( fileName ) ] = entry ;
1668
+ return this . fileNameToEntry [ this . normalizeFileName ( fileName ) ] = entry ;
1665
1669
}
1666
1670
1667
- public getEntry ( fileName : string ) : HostFileInformation {
1668
- return lookUp ( this . fileNameToEntry , normalizeSlashes ( fileName ) ) ;
1671
+ private getEntry ( fileName : string ) : HostFileInformation {
1672
+ return lookUp ( this . fileNameToEntry , this . normalizeFileName ( fileName ) ) ;
1669
1673
}
1670
1674
1671
- public contains ( fileName : string ) : boolean {
1672
- return hasProperty ( this . fileNameToEntry , normalizeSlashes ( fileName ) ) ;
1675
+ private contains ( fileName : string ) : boolean {
1676
+ return hasProperty ( this . fileNameToEntry , this . normalizeFileName ( fileName ) ) ;
1673
1677
}
1674
1678
1675
1679
public getOrCreateEntry ( fileName : string ) : HostFileInformation {
@@ -1684,8 +1688,10 @@ module ts {
1684
1688
let fileNames : string [ ] = [ ] ;
1685
1689
1686
1690
forEachKey ( this . fileNameToEntry , key => {
1687
- if ( hasProperty ( this . fileNameToEntry , key ) && this . fileNameToEntry [ key ] )
1688
- fileNames . push ( key ) ;
1691
+ let entry = this . getEntry ( key ) ;
1692
+ if ( entry ) {
1693
+ fileNames . push ( entry . hostFileName ) ;
1694
+ }
1689
1695
} ) ;
1690
1696
1691
1697
return fileNames ;
@@ -2387,7 +2393,7 @@ module ts {
2387
2393
2388
2394
function synchronizeHostData ( ) : void {
2389
2395
// Get a fresh cache of the host information
2390
- let hostCache = new HostCache ( host ) ;
2396
+ let hostCache = new HostCache ( host , getCanonicalFileName ) ;
2391
2397
2392
2398
// If the program is already up-to-date, we can reuse it
2393
2399
if ( programUpToDate ( ) ) {
@@ -2408,7 +2414,7 @@ module ts {
2408
2414
let newProgram = createProgram ( hostCache . getRootFileNames ( ) , newSettings , {
2409
2415
getSourceFile : getOrCreateSourceFile ,
2410
2416
getCancellationToken : ( ) => cancellationToken ,
2411
- getCanonicalFileName : ( fileName ) => useCaseSensitivefileNames ? fileName : fileName . toLowerCase ( ) ,
2417
+ getCanonicalFileName,
2412
2418
useCaseSensitiveFileNames : ( ) => useCaseSensitivefileNames ,
2413
2419
getNewLine : ( ) => host . getNewLine ? host . getNewLine ( ) : "\r\n" ,
2414
2420
getDefaultLibFileName : ( options ) => host . getDefaultLibFileName ( options ) ,
0 commit comments