Merge pull request #20180 from amcasey/CaseSensitiveSafeList

Convert legacy safe list keys to lowercase on construction
This commit is contained in:
Andrew Casey 2017-11-21 10:39:13 -08:00 committed by GitHub
commit b6799d7c3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -1561,7 +1561,11 @@ namespace ts.projectSystem {
path: "/a/b/foo.js",
content: ""
};
const host = createServerHost([file1, file2, customTypesMap]);
const file3 = {
path: "/a/b/Bacon.js",
content: "let y = 5"
};
const host = createServerHost([file1, file2, file3, customTypesMap]);
const projectService = createProjectService(host);
try {
projectService.openExternalProject({ projectFileName: "project", options: {}, rootFiles: toExternalFiles([file1.path, file2.path]), typeAcquisition: { enable: true } });

View file

@ -527,7 +527,11 @@ namespace ts.server {
}
// raw is now fixed and ready
this.safelist = raw.typesMap;
this.legacySafelist = raw.simpleMap;
for (const key in raw.simpleMap) {
if (raw.simpleMap.hasOwnProperty(key)) {
this.legacySafelist[key] = raw.simpleMap[key].toLowerCase();
}
}
}
catch (e) {
this.logger.info(`Error loading types map: ${e}`);