Skip to content
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

Improvements to tsc --watch #17669

Merged
merged 43 commits into from
Aug 31, 2017
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
802e283
Refactoring of the builder
sheetalkamat Jul 19, 2017
499fabc
Do not update graph in builder if compile on save is not on
sheetalkamat Jul 19, 2017
273569f
Make the host cache store the fileName instead of undefined for the m…
sheetalkamat Jul 19, 2017
94a589b
Program cannot be reused if the missing file is now present
sheetalkamat Jul 21, 2017
ef5935b
Initial refactoring so that watch from tsc follows the tsserver projects
sheetalkamat Jul 24, 2017
e068475
Refactor so that builder handles only source files and program
sheetalkamat Jul 24, 2017
6237b22
Move the builder to compiler directory
sheetalkamat Jul 24, 2017
9b18f7b
Use builder to emit the files from the tsc.js
sheetalkamat Jul 24, 2017
85b9254
Refactor out the tsc logic into another file so we can use that to te…
sheetalkamat Jul 26, 2017
69e5abd
Refactor watched system from tsserver tests so that tscLib watch can …
sheetalkamat Jul 26, 2017
c814d8e
Add tests for the tsc --watch
sheetalkamat Jul 26, 2017
2dd6aed
Emit tests
sheetalkamat Jul 29, 2017
89c61e7
Modify the api in builder so that it tracks changed files
sheetalkamat Aug 3, 2017
bb91b32
Add tests to verify emitted files
sheetalkamat Aug 3, 2017
46e3d1c
Refactoring so that instead of just using from tsc --watch the new ap…
sheetalkamat Aug 4, 2017
031a637
Switch back to have tsc.ts the only file thats different in tsc.js ge…
sheetalkamat Aug 4, 2017
0d5e6c9
Use cache for module resolution even in watch mode
sheetalkamat Aug 4, 2017
2762232
Test for the module resolution caching
sheetalkamat Aug 4, 2017
65a6ee0
Add test that fails because we dont watch module resolutions failed p…
sheetalkamat Aug 5, 2017
d55150c
Implementation of watching the failed lookup locations
sheetalkamat Aug 5, 2017
8dc6248
Partial implementation for invalidating the program (instead of sourc…
sheetalkamat Aug 5, 2017
7474ba7
Implementation for invalidating source file containing possibly chang…
sheetalkamat Aug 5, 2017
6385f7e
Get semantic diagnostics for the program from builder so that it cach…
sheetalkamat Aug 7, 2017
d0a23bb
Merge branch 'watchImprovements' into builder
sheetalkamat Aug 12, 2017
59d07dc
Simplified mutate map options
sheetalkamat Aug 14, 2017
9895082
Updating according to feedback from PR
sheetalkamat Aug 14, 2017
f1b1b12
More work based on feedback
sheetalkamat Aug 14, 2017
136b091
Update based on feedback
sheetalkamat Aug 14, 2017
6bf9133
Update to PR feedback
sheetalkamat Aug 14, 2017
a99c04e
Make the failedLookuplocations to be readonly array
sheetalkamat Aug 14, 2017
b66b752
Update based on feedback
sheetalkamat Aug 18, 2017
e639ceb
Merge branch 'watchImprovements' into builder
sheetalkamat Aug 18, 2017
8deef58
Remove the unused function from the Project since builder has this lo…
sheetalkamat Aug 18, 2017
60e2e68
Merge branch 'watchImprovements' into builder
sheetalkamat Aug 18, 2017
3908325
Merge branch 'watchImprovements' into builder
sheetalkamat Aug 21, 2017
7173da2
Adding test for #16329 to verify the caching of file system when open…
sheetalkamat Aug 18, 2017
e500be2
Adding test for #16456 to verify watched directories in case-sensitiv…
sheetalkamat Aug 19, 2017
6227a36
In Server when polling the file stat's do not send changed event in c…
sheetalkamat Aug 21, 2017
55931c4
Update the failed lookup watches without doing lookups.
sheetalkamat Aug 21, 2017
e65df12
Add test for #16955 which simulates npm install
sheetalkamat Aug 22, 2017
e711238
Add api in builder to get changed files and use it to send project ch…
sheetalkamat Aug 15, 2017
3b85f3f
Add tests to verify project changed event sent
sheetalkamat Aug 22, 2017
ea95f3b
Merge pull request #17820 from Microsoft/tsserverEventChangedFiles
sheetalkamat Aug 31, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,15 @@ namespace ts.server {

fs.stat(watchedFile.fileName, (err: any, stats: any) => {
if (err) {
watchedFile.callback(watchedFile.fileName, FileWatcherEventKind.Changed);
if (err.code === "ENOENT") {
if (watchedFile.mtime.getTime() !== 0) {
watchedFile.mtime = new Date(0);
Copy link

@ghost ghost Aug 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're using new Date(0) as a special sigil value? Why not use undefined for that purpose?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. I was using same logic that was already present. But I will look into it.

watchedFile.callback(watchedFile.fileName, FileWatcherEventKind.Deleted);
}
}
else {
watchedFile.callback(watchedFile.fileName, FileWatcherEventKind.Changed);
}
}
else {
const oldTime = watchedFile.mtime.getTime();
Expand Down