Prettier watcher firing up ~10 processes slowing down the machine

Every once in a while Prettier watcher triggers its tasks and for some reason the number of processes rises to 10-12 and stays that way for a couple of mins (it appears that it goes through all the project files, not only the ones I just edited). I basically can either kill those processes or wait for them to finish to be able to continue working without the system lagging. Is this a bug (for prettier to run over all of the files) and/or can I set the maximum number of processes to be simultaneously run to a lower value?

8 comments
Comment actions Permalink

Please check your file watcher settings - is Track only root files enabled? If yes, please try disabling it

0
Comment actions Permalink

It's disabled. But I see now there's another option that could be responsible for that, in the Advanced Options section: "Trigger the watcher on external changes". I have it enabled, I'll try to disable it to see if it solves the problem. I think it typically happens after making a commit, so this might be related.

0
Comment actions Permalink

Yes, prettifying multiple files at once after switching branches, updating a project, generating files when building a project, etc. is expected if Trigger the watcher on external changes is ON

0
Comment actions Permalink

Thanks, Elena. Is the number of processes that get triggered configurable?

0
Comment actions Permalink

No, it's hardcoded; up to 10 processes can be run in parallel

0
Comment actions Permalink

Unfortunately I'm still experiencing this problem, so I'd like to ask about two things.

1. What do the "external changes" actually mean, how do you determine whether the change was external? Apparently the processes get triggered when I checkout a different revision, even though this setting is disabled.

2. Does the watcher respect .gitignore or shall I create another file - .prettierignore - basically containing the data from .gitignore. I'm wondering if the watcher doesn't attempt to prettify node_modules for instance.

0
Comment actions Permalink

Current behavior is as follows:

File watchers are not started during update/rebase/merge/etc. Requests are scheduled and started when heavy VCS operation is done. For file watchers that have no $FileNameWithoutExtension$, $FilePathRelativeToProjectRoot$  (and other file specific) macros in Arguments filed, a watcher is run once per bulk file change; for those watchers that have file-specific macros, up to 10 watchers are run in parallel

>What do the "external changes" actually mean

when it's off, running watcher task is performed only on changing a file from IDE. External changes, including changing branch, don't trigger the watcher.

>Does the watcher respect .gitignore

it doesn't; watchers respect the watcher scope set in its settings; with the default scope - Project Files - node_modules shouldn't normally be prettified, as they are excluded from project

0
Comment actions Permalink

We have a feature request for a possibility to set the max number of spawned processes, https://youtrack.jetbrains.com/issue/WEB-40727; please feel free to vote

0

Please sign in to leave a comment.