Skip to content

Commit bae335d

Browse files
kyliauKeen Yee Liau
authored andcommitted
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 54c9bfd commit bae335d

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
@@ -53,17 +53,19 @@ export class ServerHost implements ts.server.ServerHost {
5353
* @pollingInterval - this parameter is used in polling-based watchers and
5454
* ignored in watchers that use native OS file watching
5555
*/
56-
watchFile(path: string, callback: ts.FileWatcherCallback, pollingInterval?: number):
57-
ts.FileWatcher {
58-
return ts.sys.watchFile!(path, callback, pollingInterval);
56+
watchFile(
57+
path: string, callback: ts.FileWatcherCallback, pollingInterval?: number,
58+
options?: ts.WatchOptions): ts.FileWatcher {
59+
return ts.sys.watchFile!(path, callback, pollingInterval, options);
5960
}
6061

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

6971
resolvePath(path: string): string {

0 commit comments

Comments
 (0)