-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add directory watcher for tsserver and tsc #5127
Conversation
} | ||
|
||
let parsedCommandLine = configFileToParsedCommandLine(configFileName); | ||
let newFileNames = parsedCommandLine.fileNames.map(compilerHost.getCanonicalFileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ts.map(fileNames, ..)
instead
export function copyListRemovingItem<T>(item: T, list: T[]) { | ||
let copiedList: T[] = []; | ||
for (var i = 0, len = list.length; i < len; i++) { | ||
if (list[i] != item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!==
if (!(--project.projectService.directoryWatchersRefCount[directory])) { | ||
this.log("Close directory watcher for: " + directory); | ||
project.projectService.directoryWatchersForTsconfig[directory].close(); | ||
project.projectService.directoryWatchersForTsconfig[directory] = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly use delete
👍 |
Add directory watcher for tsserver and tsc
|
||
export function copyListRemovingItem<T>(item: T, list: T[]) { | ||
let copiedList: T[] = []; | ||
for (var i = 0, len = list.length; i < len; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use for-of
pinging @zhengbli, there are few comments, can you please address them (sorry for the delay)/ |
This included a breaking API change by renaming Random aside but a new function |
This PR contains the following changes:
tsconfig.json
files in from the same directory up to the root path;tsconfig.json
file doesn't have afiles
array, and source files are added to or removed from the directory) from the same directory down recursively. (Fix server doesn't watch for file add/remove #5076, Use new node recursive file watching in tsserver #4643)tsconfig.json
file without afiles
array, also added support to detect file addition / removal undertsc --watch
. (Fix tsc: watch mode doesn't discover new files #4553)Points worth notice:
Inferred projects and configured projects have different kinds of directory watchers:
tsconfig.json
files; and the addition normally happens from the current path up. Also, it doesn't matter which project the watcher belongs to, all inferred projects can share one set of watchers if their root files happen to be in the same folder.