Skip to content

Commit 67bb67e

Browse files
committed
Cache canonical global cache's package.json path
1 parent db9620d commit 67bb67e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/server/typingsInstaller/typingsInstaller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ namespace ts.server.typingsInstaller {
8383
private safeList: JsTyping.SafeList | undefined;
8484
readonly pendingRunRequests: PendingRequest[] = [];
8585
private readonly toCanonicalFileName: GetCanonicalFileName;
86+
private readonly globalCacheCanonicalPackageJsonPath: string;
8687

8788
private installRunCount = 1;
8889
private inFlightRequestCount = 0;
@@ -97,6 +98,7 @@ namespace ts.server.typingsInstaller {
9798
private readonly throttleLimit: number,
9899
protected readonly log = nullLog) {
99100
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
101+
this.globalCacheCanonicalPackageJsonPath = combinePaths(this.toCanonicalFileName(globalCachePath), "package.json");
100102
if (this.log.isEnabled()) {
101103
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation}`);
102104
}
@@ -440,7 +442,7 @@ namespace ts.server.typingsInstaller {
440442
return;
441443
}
442444
f = this.toCanonicalFileName(f);
443-
if (isPackageOrBowerJson(f) && f !== this.toCanonicalFileName(combinePaths(this.globalCachePath, "package.json"))) {
445+
if (f !== this.globalCacheCanonicalPackageJsonPath && isPackageOrBowerJson(f)) {
444446
watchers.isInvoked = true;
445447
this.sendResponse({ projectName, kind: ActionInvalidate });
446448
}

0 commit comments

Comments
 (0)