-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add way to exclude files and directories to watch #39243
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
Conversation
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @amcasey, @mjbvz, @minestarks for you. Feel free to loop in other consumers/maintainers if necessary |
This is now ready for review |
Remind me how the editor does this? Is there a protocol refresh to re-poll the disk?
Does that mean Windows and Mac do support recursive watching? |
Restart tsserver from vscode.. Dont know about vs command for that
Yes: https://git.1-hub.cnmicrosoft/TypeScript/blob/master/src/compiler/sys.ts#L1163 |
That seems like overkill. Wouldn't there be a shorter delay if we just repolled all the files and then did an |
It looks like there's a Looks like VS Code uses |
cc @mjbvz for the VS Code user experience. |
@amcasey Interesting point. I think reload should definitely reload everything and makes sense to refresh but i would need to think about how to do that when server is not restarted... |
@sheetalkamat I was thinking it would be like simulating a file listener event - the server would just do whatever it does when it finds out one or more files have changed on disk (ideally, as a batch, rather than as a loop of updates). |
Thanks for this PR @sheetalkamat. I really look forward for this PR to be merged as VS Code/TypeScript is unfortunately too often unresponsive on Linux when I'm working on one of my project that has about 2000 packages in |
That'd be amazing to have this one resolved finally. It has been first reported almost 2 years ago and there's little progress.
That's quite extensive for a (Fedora31, vsc 1.47.2) |
@amcasey i have updated the PR per your suggestion so that reload projects, loads the project from scratch |
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.
This is a surprisingly large change and I'm still going through some things, but here's my first round of comments.
@mjbvz Could you possibly confirm that the new project reload functionality behaves sensibly in VS Code? I don't believe VS uses it. |
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.
Protocol changes look good to me.
Do you think we should add VS Code settings to control this too?
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.
I like the concept, I have some quibbles with the implementation, and I have one remaining concern: can I disable all file watching and just hit "refresh" in the editor to trigger it when I need it?
Are there any docs for this feature? Also, does this automatically take the |
By default nothing is ignored. User has to opt for directories/files to ignore.. |
Thanks sheetal - looks like I manually re-created a partial set of the watch flags back when I made the tsconfig reference, will move it to be automatic to pick these up! |
@orta @sheetalkamat I cant seem to find any docs on this. https://www.typescriptlang.org/tsconfig#Watch_Options_999 This has nothing about the new fields that are supposed to be added. Im trying to add
to my tsconfig but Im still getting extremely slow load times on my project when using vscode in WSL with files on the C drive |
@Kierchon it also needs to be set in vscode preferences but i dont find it in vscode preferences in |
You should just be able to add them in the "typescript.tsserver.watchOptions": {
"watchFile": "useFsEvents",
"excludeDirectories": []
}, We pass the entire object on the TS Server @sheetalkamat Should these settings also be documented? If so, can you please share a quick blurb about what these two settings do |
This allows user a way to specify directories and/or files to ignore:
watchOptions
:excludeFiles
andexcludeDirectories
in tsconfig as well as command linenoopWatcher
for files and directories that are being watched.This provides a way on systems where watching can be expensive and letting user refresh things if something changes rather than us having to poll or rely on events
Fixes #33335, #36035, #36243, #36394