Make safelist an instance field of ProjectService (#17307)

This commit is contained in:
Andy 2017-07-26 13:47:44 -07:00 committed by GitHub
parent 61c6ecbb2d
commit 6f90b3112a

View File

@ -370,7 +370,7 @@ namespace ts.server {
private readonly throttledOperations: ThrottledOperations;
private readonly hostConfiguration: HostConfiguration;
private static safelist: SafeList = defaultTypeSafeList;
private safelist: SafeList = defaultTypeSafeList;
private changedFiles: ScriptInfo[];
@ -1620,7 +1620,7 @@ namespace ts.server {
}
resetSafeList(): void {
ProjectService.safelist = defaultTypeSafeList;
this.safelist = defaultTypeSafeList;
}
loadSafeList(fileName: string): void {
@ -1630,7 +1630,7 @@ namespace ts.server {
raw[k].match = new RegExp(raw[k].match as {} as string, "i");
}
// raw is now fixed and ready
ProjectService.safelist = raw;
this.safelist = raw;
}
applySafeList(proj: protocol.ExternalProject): void {
@ -1641,8 +1641,8 @@ namespace ts.server {
const normalizedNames = rootFiles.map(f => normalizeSlashes(f.fileName));
for (const name of Object.keys(ProjectService.safelist)) {
const rule = ProjectService.safelist[name];
for (const name of Object.keys(this.safelist)) {
const rule = this.safelist[name];
for (const root of normalizedNames) {
if (rule.match.test(root)) {
this.logger.info(`Excluding files based on rule ${name}`);