Skip to content

Commit dc2b00c

Browse files
authored
(fix) set watchFile polling interval (#1764)
marked as optional, but seems to be required in TS 4.9
1 parent 37d73e9 commit dc2b00c

File tree

1 file changed

+7
-2
lines changed
  • packages/language-server/src/plugins/typescript

1 file changed

+7
-2
lines changed

packages/language-server/src/plugins/typescript/service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,11 @@ async function createLanguageService(
555555
}
556556

557557
if (!configWatchers.has(tsconfigPath) && tsconfigPath) {
558-
configWatchers.set(tsconfigPath, tsSystem.watchFile(tsconfigPath, watchConfigCallback));
558+
configWatchers.set(
559+
tsconfigPath,
560+
// for some reason setting the polling interval is necessary, else some error in TS is thrown
561+
tsSystem.watchFile(tsconfigPath, watchConfigCallback, 1000)
562+
);
559563
}
560564

561565
for (const config of extendedConfigPaths) {
@@ -565,7 +569,8 @@ async function createLanguageService(
565569

566570
extendedConfigWatchers.set(
567571
config,
568-
tsSystem.watchFile(config, createWatchExtendedConfigCallback(docContext))
572+
// for some reason setting the polling interval is necessary, else some error in TS is thrown
573+
tsSystem.watchFile(config, createWatchExtendedConfigCallback(docContext), 1000)
569574
);
570575
}
571576
}

0 commit comments

Comments
 (0)