PhpStorm 2021.2 Help

File Watchers

The page is available when the File Watchers plugin is enabled. For more information about configuring File Watchers, see File Watchers. The File Watchers plugin is bundled with PhpStorm and activated by default. If the plugin is disabled, enable it on the Installed tab of the Settings/Preferences | Plugins page, as described in Managing plugins.

A File Watcher is a PhpStorm system that tracks changes to your files and runs a third-party standalone application. PhpStorm provides predefined File Watcher templates for a number of such standard popular third-party tools (compilers, compressors, prettifiers, and others).

You can also configure a custom File Watcher to run any other third-party tool.

File Watchers have two dedicated code inspections:

  • The File Watcher available inspection is run in every file where a predefined File Watcher is applicable. If the project has no relevant File Watcher configured, PhpStorm suggests to add one.

  • The File Watcher problems inspection is invoked by a running File Watcher and highlights errors specific to it.

The page consists of a list of available File Watchers and a toolbar to manage this list.

For each File Watcher, you can decide if it’s going to be available only in the current project (select Project from the Level list) or for all projects (select Global).

To activate a File Watcher, select the checkbox next to it. When a File Watcher is enabled, it starts automatically as soon as a file of the selected type and in the selected scope is changed or saved, see Configuring advanced options. If an error occurs while a File Watcher is running, the File Watcher is automatically disabled. To restore the status, enable the File Watcher manually.

Item

Tooltip and shortcut

Description

the Add button

Add Alt+Insert

Click this button to open the Choose template popup and select the relevant type of File Watcher. After that PhpStorm opens the New Watcher dialog for customizing the predefined File Watcher according to the settings of the current project.

the Edit button

Edit Enter

Click this button to update the settings of the selected File Watcher in the Edit Watcher dialog. The update is applied to the current project File Watcher only, it does not affect the predefined PhpStorm-level template.

the Remove button

Remove Alt+Delete

Click this button to remove the selected File Watcher. The File Watcher is no longer applied to the files in the current project. Note that this action does not affect the corresponding predefined template which is still available at the PhpStorm level.

the Previous occurrence button  the Next occurrence button

Up Ctrl+Alt+Up

Down Ctrl+Alt+Down

Use these buttons to change the order of File Watcher in the list. This determines the order of launching File Watchers, if more than one are enabled.

copy

Copy

Use this button to create a copy of the selected File Watcher.

import

Import

Click this button to import an existing File Watcher and add it to the list of available File Watchers.

export

Export

Click this button to export the selected watchers to watchers.xml file, located under the user's home.

Last modified: 14 September 2021