-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TSServer doesn't respect watchOptions for watchFile #41549
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
Comments
@zhengbli Apologies if you're no longer involved with TypeScript, but if you have a moment I'm curious if it was intentional for this to be non-configurable in |
This affects language service plugins that provide typings for imported files. mrmckeb/typescript-plugin-css-modules#95 To summarize, I'm trying to set up CSS type checks but not seeing updates happen until 7+ minutes later due to tsserver's polling watch being slow. |
What an awesome improvement would it be at least on MacOS VSCode! We currently wait for 20-40 seconds after a git pull for some files to be typechecked properly in VSCode. I made an experiment, manually commented out the code @gluxon mentioned above right in tsserver.js: and it made VSCode pickup changes within several seconds. |
@sheetalkamat Do you have any updates on whether this is something that the TypeScript team is interested in accepting a fix for? This is the only thing blocking my team from adding type-safety to the last untyped piece of our codebase (CSS modules). |
This is scheduled for 4.2.1 |
@sheetalkamat Thanks! 🎉 |
This seems to be intentional, but it looks like TSServer always uses fixed polling to watch files regardless of editor configured options.
The relevant code was written 4.5 years ago. Does the TypeScript team plan on revisiting that decision? If not, should the
watchFile
option have its choices limited to reduce confusion? (I understand that will partly be a VSCode issue if the answer is yes.)Personally I think it's strange that this is configurable in
tsc
but nottsserver
.Technical Details:
Here's the
watchUtilities.ts
call, which passes aWatchOptions
arg:TypeScript/src/compiler/watchUtilities.ts
Line 440 in 4885dec
TypeScript/src/compiler/types.ts
Lines 5844 to 5853 in 4885dec
Here's the implemention in
tsserver
, which actually overrides the default implementation and ignores theoptions
arg.TypeScript/src/tsserver/server.ts
Lines 885 to 890 in 4885dec
tsserver.log
also reports awatchFile
option of3
(WatchFileKind.UseFsEvents
), which is incorrect.TypeScript Version: v4.2.0-dev.20201112
Search Terms:
Steps to Reproduce
Add the following to VSCode
settings.json
:Expected behavior:
Actual behavior:
The text was updated successfully, but these errors were encountered: