Hi @Tomohiro_Hiratsuka, thanks for the follow-up — the restart numbers are very helpful.
The fact that the count returns to roughly 9,800 files under backend/nestjs/src immediately after a restart suggests something that watches every TypeScript file in the project, rather than something that accumulates over a long session. Our leading suspect is the TypeScript language service’s file watching, which currently runs through Cursor’s main process and holds one open handle per watched file on macOS.
Could you try the following to confirm?
- In a terminal, from the workspace folder, run this and note the number:
find backend/nestjs/src -name '*.ts' | wc -l - Fully quit Cursor (
Cmd + Q) and reopen it with the same workspace. - Close all editor tabs (
Cmd + K, thenW) so no TypeScript file is open. Wait about a minute, then note the count from:lsof -p "$(pgrep -x Cursor | head -1)" | wc -l - Open any
.tsfile underbackend/nestjs/src, wait 2–3 minutes for the TypeScript service to finish loading the project, then run the same count again.
If step 4 is where the count jumps by thousands (and the number from step 1 is close to the 9,802 you saw), please add the following to your user settings (Cmd + Shift + P, then Preferences: Open User Settings (JSON)), restart Cursor, and repeat steps 3 and 4:
"js/ts.tsserver.watchOptions": {
"watchFile": "useFsEventsOnParentDirectory",
"watchDirectory": "useFsEvents"
}
This makes TypeScript watch folders instead of individual files. If the count stays low with that setting in place, it confirms the cause — and the setting also serves as a workaround.
Two small additional asks:
- Could you paste your
backend/nestjs/tsconfig.json(or at least itsinclude,exclude,filesandwatchOptionssections, if present)? - Do you already have any
typescript.tsserver.*/js/ts.tsserver.*orfiles.watcherExcludeentries in your settings?
Please share the numbers from steps 1, 3 and 4 either way.