microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.88k stars 12.47k forks source link

createDirectoryWatcher called for in-memory file #59508

Open mjbvz opened 2 months ago

mjbvz commented 2 months ago

🔎 Search Terms

🕗 Version & Regression Information

5.6.0-dev.20240729

Not a regression

⏯ Playground Link

No response

💻 Code

https://github.com/microsoft/vscode/issues/221583

It appears that TS sometimes tries creating a directory watcher for in memory files. For example, I see these calls in the TS Server logs:

Info 46165[16:37:11.625] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 46166[16:37:11.646] DirectoryWatcher:: Added:: WatchInfo: ^/vscode-chat-code-block/899b87a4-39f1-4438-af0b-c7a57080a918/response_0/0#... 0 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations
Info 46167[16:37:11.646] event:
    {"seq":0,"type":"event","event":"createDirectoryWatcher","body":{"id":4619,"path":"^/vscode-chat-code-block/899b87a4-39f1-4438-af0b-c7a57080a918/response_0/0...","recursive":false,"ignoreUpdate":true}}
Info 46168[16:37:11.647] Elapsed:: 0.07062499225139618ms DirectoryWatcher:: Added:: WatchInfo: ^/vscode-chat-code-block/899b87a4-39f1-4438-af0b-c7a57080a918/response_0/0#... 0 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations

🙁 Actual behavior

These are purely in-memory files so we shouldn't create watchers or directory watchers for them\

🙂 Expected behavior

Watchers should not be created. There's no directory that can change here

Additional information about the issue

No response

mjbvz commented 2 months ago

Going to add some workarounds on the VS Code side but would be best to avoid these calls in the first place