Fixes to handle file names in module resolution watching and createGetCanonicalFileName (#36106)

* Add test case to verify directory casing preservation when watching

* Fix unicode file name handling when watching failed lookup locations

* Add special file name lower conversion routine and use that instead of toLowerCase
Fixes #31819 and #35559

* Remove unicode from code

* Replace toLocaleLowerCase on filenames with ts.toFileNameLowerCase

* Make the intent of using toFileNameLowerCase more clear and why we make the restriction on turkish I with dot on top of it

* Update baselines for newly added tests in master
This commit is contained in:
Sheetal Nandi
2020-01-31 10:40:57 -08:00
committed by GitHub
parent ad8feb5f90
commit 80ad0de87e
185 changed files with 2867 additions and 2696 deletions

View File

@@ -1256,7 +1256,20 @@ namespace ts.server {
const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) ||
this.getOrCreateSingleInferredProjectIfEnabled() ||
this.getOrCreateSingleInferredWithoutProjectRoot(info.isDynamic ? projectRootPath || this.currentDirectory : getDirectoryPath(info.path));
this.getOrCreateSingleInferredWithoutProjectRoot(
info.isDynamic ?
projectRootPath || this.currentDirectory :
getDirectoryPath(
isRootedDiskPath(info.fileName) ?
info.fileName :
getNormalizedAbsolutePath(
info.fileName,
projectRootPath ?
this.getNormalizedAbsolutePath(projectRootPath) :
this.currentDirectory
)
)
);
project.addRoot(info);
if (info.containingProjects[0] !== project) {
@@ -3354,7 +3367,7 @@ namespace ts.server {
else {
let exclude = false;
if (typeAcquisition.enable || typeAcquisition.enableAutoDiscovery) {
const baseName = getBaseFileName(normalizedNames[i].toLowerCase());
const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
if (fileExtensionIs(baseName, "js")) {
const inferredTypingName = removeFileExtension(baseName);
const cleanedTypingName = removeMinAndVersionNumbers(inferredTypingName);

View File

@@ -2230,7 +2230,7 @@ namespace ts.server {
}
getCanonicalFileName(fileName: string) {
const name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
const name = this.host.useCaseSensitiveFileNames ? fileName : toFileNameLowerCase(fileName);
return normalizePath(name);
}