Skip to content

TypeScript installs file watchers, ignoring files.watcherExclude setting #183177

@jelmd

Description

@jelmd

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.78.2
  • OS Version: Linux (Ubuntu 20.04)

Steps to Reproduce:

  1. mkdir myapp

cat >package.json<<EOF
{
"name": "foobar",
"description": "Test",
"repository": "https://github.com/x/y",
"bugs": {
"url": "https://github.com/x/y/issues"
},
"author": "Foo Bar [email protected]",
"contributors": [],
"version": "0.1.0",
"private": true,
"scripts": {
"db": "NODE_OPTIONS='--no-warnings --loader ts-node/esm' nodemon --watch scripts scripts/db.ts",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"clean": "rm -rf .next",
"realclean": "rm -rf .next node_modules package-lock.json"
},
"dependencies": {
"@next-auth/prisma-adapter": "^1.0.6",
"@prisma/client": "^4.14.1",
"next": "13.4.3",
"nodemailer": "^6.9.2",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@styled-icons/material": "^10.47.0",
"@styled-icons/fa-solid": "^10.47.0",
"@types/busboy": "^1.5.0",
"@types/node": "20.2.3",
"@types/nodemailer": "^6.4.8",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"eslint": "8.41.0",
"eslint-config-next": "13.4.3",
"prisma": "^4.14.1",
"typescript": "5.0.4"
}
}
EOF
4. npm i
5. with super user privileges: sysctl fs.inotify.max_user_watches=4096
6. adjust excludes in ~/.config/Code/User/settings.json. E.g.:

{
   "files.watcherExclude": {
        "**/.git/objects": true,
        "**/.git/subtree-cache": true,
        "**/.nfs*": true,
        "**/*.swp": true,
        "**/node_modules": true,
        "**/.next": true
    },
 }
  1. code .

No matter, what you specify, code still watches all directories, even so it is not desired at all to watch anything below ./node_models/. In the example above these are ~ 4K directories. This is a huge waste of resources and should be fixed (beside it causes other problems with other misbehaving apps, which do similar insane things ...).

To inspect inotify watches in a very easy way, it is highly recommended to use a tool like inotify-info!

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)bugIssue identified by VS Code Team member as probable bugfile-watcherFile watchertypescriptTypescript support issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions