Skip to content

Commit 698d7af

Browse files
committed
fix: pass watch options to watchFile and watchDirectory
The options are needed so that the server respects the `WatchOptions` provided by users in their tsconfig.json. ```ts export interface WatchOptions { watchFile?: WatchFileKind; watchDirectory?: WatchDirectoryKind; fallbackPolling?: PollingWatchKind; synchronousWatchDirectory?: boolean; excludeDirectories?: string[]; excludeFiles?: string[]; [option: string]: CompilerOptionsValue | undefined; } ``` fix #636
1 parent 743f9a9 commit 698d7af

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

server/src/server_host.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,19 @@ export class ServerHost implements ts.server.ServerHost {
5454
* @pollingInterval - this parameter is used in polling-based watchers and
5555
* ignored in watchers that use native OS file watching
5656
*/
57-
watchFile(path: string, callback: ts.FileWatcherCallback, pollingInterval?: number):
58-
ts.FileWatcher {
59-
return ts.sys.watchFile!(path, callback, pollingInterval);
57+
watchFile(
58+
path: string, callback: ts.FileWatcherCallback, pollingInterval?: number,
59+
options?: ts.WatchOptions): ts.FileWatcher {
60+
return ts.sys.watchFile!(path, callback, pollingInterval, options);
6061
}
6162

62-
watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean):
63-
ts.FileWatcher {
63+
watchDirectory(
64+
path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean,
65+
options?: ts.WatchOptions): ts.FileWatcher {
6466
if (this.isG3 && path.startsWith('/google/src')) {
6567
return NOOP_WATCHER;
6668
}
67-
return ts.sys.watchDirectory!(path, callback, recursive);
69+
return ts.sys.watchDirectory!(path, callback, recursive, options);
6870
}
6971

7072
resolvePath(path: string): string {

0 commit comments

Comments
 (0)