Description
Bug Report
When using tsserver in VSCode, I sometimes see persistent false error reports from diagnostics after a large rebase or checkout of the form, "File '{}' is not listed within the file list of project '{}'. Projects must list all files or use an 'include' pattern." The file mentioned in the error is a file that was newly created as part of the checkout or rebase. After waiting several minutes and noticing that the logs are idle, the only solution is to restart tsserver.
I have a repro case I would be willing to demonstrate live. In the repro, I have a file open (call it OpenFile.tsx) which imports a new file (call it NewFile.tsx). Here is a timeline of events in the logs related to a file that repros this issue:
- A DirectoryWatch event of type Wild card directory is triggered for NewFile
- A DirectoryWatch event of type Failed Lookup Locations is triggered for NewFile
- Lots of other watch processing is happening...
- A projectUpdatedInBackground event fires for the project that OpenFile and NewFile belong to
- A request comes into the language service for OpenFile's diagnostics
- An upgradeGraphWorker starts for the project that OpenFile and NewFile belong to
- A FileWatch is added for NewFile (Closed Script info type)
- The upgradeGraphWorker completes, and NewFile is listed in the long list of files and "Imported from" statements
- semanticDiag reports an error for OpenFile
In separate repros, I've noticed that...
(1) and (2) can swap places
(4) does not always happen. Maybe something else triggers the request?
🔎 Search Terms
IDE, VSCode, tsserver
🕗 Version & Regression Information
I don't have any information about when this started. It's been a problem that we have noticed for a long time. Our project is on 4.5.4
⏯ Playground Link
I can repro this but not on playground
💻 Code
I can repro this but not on playground
🙁 Actual behavior
A persistent incorrect semantic diagnostic saying that a file is missing after a large rebase or checkout
🙂 Expected behavior
After a reasonable amount of time, no semantic errors