Skip to content

Commit 9e6501c

Browse files
committed
Merge pull request microsoft#4405 from zhengbli/fixTsconfigWatcherIssue
Fix issue when the newly added files in tsconfig is not opened
2 parents ecaf16d + 69bc569 commit 9e6501c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/server/editorServices.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1116,13 +1116,15 @@ namespace ts.server {
11161116
else {
11171117
// if the root file was opened by client, it would belong to either
11181118
// openFileRoots or openFileReferenced.
1119-
if (this.openFileRoots.indexOf(info) >= 0) {
1120-
this.openFileRoots = copyListRemovingItem(info, this.openFileRoots);
1119+
if (info.isOpen) {
1120+
if (this.openFileRoots.indexOf(info) >= 0) {
1121+
this.openFileRoots = copyListRemovingItem(info, this.openFileRoots);
1122+
}
1123+
if (this.openFilesReferenced.indexOf(info) >= 0) {
1124+
this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced);
1125+
}
1126+
this.openFileRootsConfigured.push(info);
11211127
}
1122-
if (this.openFilesReferenced.indexOf(info) >= 0) {
1123-
this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced);
1124-
}
1125-
this.openFileRootsConfigured.push(info);
11261128
}
11271129
project.addRoot(info);
11281130
}

0 commit comments

Comments
 (0)