mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user