Skip to content

Initializing JS/TS language features ignores files.watcherExclude #29782

Description

@claritysolutionsteam

details

Initially vs code respects files.watcherExclude upon opening a workspace if no js/ts files are open vs code correctly watches all files in the workspace except for those indicated by files.watcherExclude
However as soon as a JS/TS file is opened the message "initializing JS/TS language features" is shown on the status bar and vscode watches all files.

reproducing

  1. veryify that excludes some things in the work space
    file > preferences > settings > files.watcherExclude
  2. close all open files and restart vs code
  3. veryify that vs code is watching all files in the workspace that are not excluded
  4. open (or create) a .js or .ts file
  5. see initializing JS/TS language features on the bottom status bar
  6. observe that vs code is watching all files in the workspace

exepected result: vs code should not watch files in the files.watcherExclude setting
actual result: vs code watches all files as soon as JS/TS language features are enabled

how to see what files vs code is watching

There are a number of ways to do this on linux (none of them all that easy).
Exact method may vary depending on version of linux
There are a number of methods discussed in https://unix.stackexchange.com/questions/15509/whos-consuming-my-inotify-resources/426001#426001
The method I used was to find the PID of code using ps EG: ps aux|grep code
this turns up multiple processes as code spawns subprocesses
then take those pids and
grep /proc//fdinfo/* inotify
the text on these lines seems to vary depending on linux version so it may read something else other then inotify
at least on CentOS Linux 7 (Core) these lines contain ino:
from there the number of files being watched can be compared to the number of files expected to be watched or
some method of stating the files in the workspace can be used to see exactly which files are being watched
for example ls -i will tell the inode number of the files listed (in decimal)

VS Code version: Code 1.30.2 (61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8, 2019-01-07T22:49:48.319Z)
OS version: Linux x64 3.10.0-862.3.2.el7.x86_64

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz (8 x 2699)
GPU Status 2d_canvas: unavailable_software
checker_imaging: disabled_off
flash_3d: unavailable_software
flash_stage3d: unavailable_software
flash_stage3d_baseline: unavailable_software
gpu_compositing: unavailable_software
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: unavailable_software
video_encode: unavailable_software
webgl: enabled_readback
webgl2: unavailable_off
Load (avg) 1, 1, 1
Memory (System) 59.97GB (0.97GB free)
Process Argv --disable-extensions
Screen Reader no
VM 0%
Extensions disabled

Activity

  1. mjbvz commented on Feb 5, 2019

    @mjbvz

    files.watcherExclude only controls core VS Code's file watching; each language extension implements their own file watching/exclude logic. For js/ts, try using creating a jsconfig.json project definition for your projec tand configure exclude

    Also please try updating to the latest VS Code insiders build

  2. claritysolutionsteam commented on Feb 5, 2019

    @claritysolutionsteam
    Author

    This tsconfig.json doesn't seem to help
    {
    "compilerOptions": {
    "jsx": "react",
    "lib":["es2017", "dom"],
    "downlevelIteration": true,
    "noImplicitThis": true,
    "noImplicitReturns":true,
    "target":"ES2017",
    "moduleResolution":"node",
    "noImplicitAny":true
    },
    "exclude": [
    "/node_modules/",
    "/.git/"
    ]
    }

    Everything watched as soon as Initializing JS/TS language finishes. This seems to indicate that there is a problem with the language language extension(?) or that this is the wrong way to configure it.
    Tried the insiders version and got the same behavior. Here is a copy of that version's help>about:
    Version: 1.31.0-insider
    Commit: b313db6c58f8c02181a33cd3b5b4b17c64a5b85d
    Date: 2019-02-05T10:12:40.290Z
    Electron: 3.1.2
    Chrome: 66.0.3359.181
    Node.js: 10.2.0
    V8: 6.6.346.32
    OS: Linux x64 3.10.0-862.3.2.el7.x86_64

  3. mjbvz commented on Feb 5, 2019

    @mjbvz

    Is the file watching actually causing any problems though?

  4. claritysolutionsteam commented on Feb 6, 2019

    @claritysolutionsteam
    Author

    Occasionally in combination with the use of an npm dev server the machine runs out of watcher quota. Sometimes vs code complains it can't watch all the files in the large workspace. It's a shared machine, and while I haven't had any complaints yet, this can cause other things that use watches to fail such as tail -f.

  5. removed their assignment
    on Feb 6, 2019
  6. mjbvz commented on Feb 6, 2019

    @mjbvz

    Moving over to TypeScript since it is the tsserver that is watching these files

  7. sheetalkamat commented on Feb 6, 2019

    @sheetalkamat
    Member

    tsserver doesn't let you configure the watches you want to exclude. This is for best experience in vscode. I am not sure what action we can take here.
    cc Ryan Cavanaugh (@RyanCavanaugh) Daniel Rosenwasser (@DanielRosenwasser) Andrew Casey (@amcasey)

  8. claritysolutionsteam commented on Feb 6, 2019

    @claritysolutionsteam
    Author

    Is there anything we can do to stop it from watching the /.git files? That directory doesn't have any files I would want typescript looking at.

  9. RyanCavanaugh commented on Feb 14, 2019

    @RyanCavanaugh
    Member

    Sheetal Nandi (@sheetalkamat) I don't think we should ever be watching .git - can you verify that this folder is always excluded from our watches?

  10. sheetalkamat commented on Feb 14, 2019

    @sheetalkamat
    Member

    Currently we ignore anything thats dotted directory/file in node_modules. We can add .git to that list

  11. added
    DuplicateAn existing issue was already created
    Needs InvestigationThis issue needs a team member to investigate its status.
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    DuplicateAn existing issue was already created
    on Feb 27, 2019
  12. added
    BugA bug in TypeScript
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on Mar 6, 2019
  13. added a commit that references this issue on Mar 6, 2019
    ec2ee9f
  14. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions