-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Watch events enhancements #57950
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
Merged
Merged
Watch events enhancements #57950
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6f58ab7
Add test for node_modules file
sheetalkamat ddbd1ce
Dont watch for update events if not watching node_modules directory
sheetalkamat d1dcc7a
Change protocol to send events together for watchChange
sheetalkamat 7b998fa
API baseline
sheetalkamat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can this path be
\node_modules
on Windows?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.
Slightly related: I did notice another watch request for
node_modules/@types
, so I wonder if these could alsoignoreUpdate
?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.
it isnt "\node_module" on windows because our paths are normalized.
We dont care about updates in
node_modules/@types
since thats not what we watch for file updates. We only watchnode_modules
for updates to scriptinfos that are anywhere including in@types
so this condition sufficesThere 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.
Hm, I think I misunderstood our discussion around changes in
node_modules
then. I had assumed TS only cares about added/deleted events innode_modules
to rerun module resolution, but not for updates. So now with your change, folder watchers ignore updates unless itsnode_modules
being watched?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.
Yes. we only care about
updates
insidenode_modules
and no other folder.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.
Reference to code here https://github.com/microsoft/TypeScript/blob/main/src/server/editorServices.ts#L3102 this normally works out because with fs.watch most of the time we get "rename" event instead of "change" when doing
npm i
but with parcel you getupdate
so that cannot be ignored from vscode watcher usage perspectiveThere 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.
Yeah I understand. My idea was to collect events to
node_modules
in the TS extension and then send you a single event per module that is impacted to the server. That can be aadded
event to emulate therename
you got fromfs.watch
. Its a bit of a hack and very specific to this case but would essentially reduce the event load onnode_modules
, which can be a huge source of file events. I do not have strong feelings though, now with the batching it might not make much of a difference.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.
What i meant by
ignoreUpdate
here is that we really dont care if there is file that was modified within that folder and thats true for any folder watched exceptnode_modules
. So from protocol wise this change looks good.On whether to send single
directory event
formodule
insidenode_modules
or all files can be totally customized irrespective of this protocol change. In general, the more specific you are about thepath
the better reuse happens between programs. We were anyways getting these events fromfs.watch
and we handle both cases since the fileName may or may not be present when the event comes throughfs.watch
.