5

I have looked everywhere for documentation that explains the various template variables used in file watcher but I can't find anything. I know what some of them mean, but is there an exhaustive list of variables that are defined.

Examples:

$FilePathRelativeToProjectRoot$
$FileNameWithoutExtension$
$FileDirPathFromParent(js)$

Live Template Variables describe a couple but it doesn't seem to be an exhaustive list.

1
  • Live Templates have nothing to do with macro variables (that are used in External Tools/File Watchers) -- they are completely separate/different things. See the Lena's answer. Commented Jun 28, 2017 at 13:56

4 Answers 4

3

The only available documentation is the short macro description in the Macros dialog (shown on pressing Insert macro... button). BTW, this dialog has macro preview for currently opened file.

$FilePathRelativeToProjectRoot$ is a file path from project root/module content root folder. For example, if the file is <Project root>/app/stylesheets/style.less, $FilePathRelativeToProjectRoot$ will return app/stylesheets/style.less

$FileNameWithoutExtension$ is, well, a file name without extension:) A result of $FileName$.substring(0, file.lastIndexOf('.')). For style.less it will be style

$FileDirPathFromParent(js)$ - path to file directory relative to the js directory

Sign up to request clarification or add additional context in comments.

Comments

2

Sorry folks, I knew I say it yesterday. You can see all the variables by selecting insert macro next to the File Watchers Arguments and Output paths fields.

Comments

0

Unfortunately some of them are indeed not documented, but they can be found on our tracker e.g. https://youtrack.jetbrains.com/issue/IDEA-28253

You can submit a feature request there to update online documentation to include those variables.

1 Comment

Documentation updates shouldn't need a "Feature Request". Especially when your users are paying customers. Especially when the demand for the info is clear from the fact that there is a StackOverflow question with hundreds of views.
-1

Actually the template variables is just a variable in any programming language, you can define whatever you want, evening a, b, ab ...... any legal

And the variable's scope is only in the template text, and you can define the variable like the default value in the "Edit Variables".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.