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?
Please sign in to leave a comment.
Please check your file watcher settings - is Track only root files enabled? If yes, please try disabling it
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.
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
Thanks, Elena. Is the number of processes that get triggered configurable?
No, it's hardcoded; up to 10 processes can be run in parallel
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.
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
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
Change the scope to "Changed Files"