New Watcher Dialog
The dialog opens when you click the Add or Edit button on the File Watchers page. Use the dialog box to create a project File Watcher based on a predefined AppCode File Watcher template or to edit an existing project File Watcher.
Each template contains the settings that are optimal for the selected tool. So in most cases, all you need is specify the path to the tool's executable.
Name
In the Name text box, type the name of the File Watcher. By default, AppCode suggests the name of the selected predefined template.
Files to watch
File type | Use this drop-down list to specify the expected type of input files. The File Watcher will consider only files of this type as subject for analyzing and processing. File types are recognised based on associations between file types and file extensions. |
Scope | Use this drop-down list to define the range of files the File Watcher can be applied to. Changes in these files will invoke the File Watcher either immediately or upon save or frame deactivation, depending on the status of the Auto-save edited files to trigger the watcher checkbox. Choose one of the predefined scopes from the drop-down list or click and configure a custom scope in the Scopes dialog that opens. |
Track only root files | A root file is a file that is not included (e.g. via import ) in any other file within the specified scope.
Example |
Tool to run on changes
In this area, configure interaction with the tool: specify the executable file to use, the arguments to pass to it, and customize the default template settings for input and output.
Working Directory and Environment Variables
Working directory | In this text box, specify the directory to which the tool will be applied. Because the tool is always invoked in the context of a file, the default working directory is the directory of the current file. The default working directory is specified in all predefined templates through a |
Environment variables | In this text box, specify the environment variables that the tool requires but that are not specified at the operating system level. |
Advanced Options
Examples of customizing the behaviour of an external tool
The only way to influence a third-party tool is pass arguments to it just as if you were working in the command line mode. These arguments are specific to each tool. Below are two examples of customizing the default output location for the CoffeeScript compiler.
Suppose, you have a project with the following folder structure: By default, the generated files will be stored in the folder where the original file is. You can change this default location and have the generated files stored in the js
folder. Moreover, you can have them stored in a flat list or arranged in the folder structure that repeats the original structure under the app
node.
- To have all the generated files stored in the output
js
folder without retaining the original folder structure under theapp
folder:In the Arguments text box, type:
--output $ProjectFileDir$\js\ --compile --map $FileName$
In the Output paths to refresh text box, type:
$ProjectFileDir$\js\$FileNameWithoutExtension$.js:$ProjectFileDir$\js\$FileNameWithoutExtension$.map
As a result, the project tree looks as follows:
- To have the original folder structure under the
app
node retained in the outputjs
folder:In the Arguments text box, type:
--output $ProjectFileDir$\js\$FileDirRelativeToProjectRoot$\ --compile --map $FileName$
In the Output paths to refresh text box, type:
$ProjectFileDir$\js\$FileDirRelativeToProjectRoot$\$FileNameWithoutExtension$.js:$ProjectFileDir$\js\$FileDirRelativeToProjectRoot$\$FileNameWithoutExtension$.map
As a result, the project tree looks as follows: