
Returns the characters that indicate the start of a block comment in the current language context.įor example, in Java files it returns /*.įor example, camelCase("my-text-file"), camelCase("my text file"), and camelCase("my_text_file") all return myTextFile.Ĭapitalizes the first letter of a string.įor example, capitalize("name") returns Name. Returns the characters that indicate the end of a block comment in the current language context.įor example, in Java files it returns */. Some predefined live templates in the iterations group ( itar and ritar) use the arrayVariable() function. The following functions can be used to define live template variables:
PHPSTORM FORMAT CODE IN SELECTION CODE
For example, if you select EXAMPLE in your code and invoke the "$SELECTION$" template via the assigned abbreviation or by pressing Control+Alt+T and selecting the desired template from the list, IntelliJ IDEA will wrap the selection in double quotes as follows: "EXAMPLE".įunctions used in live template variables After the template expands, it wraps the selected text as specified in the template. $SELECTION$ is used in surround templates and denotes the code fragment to be wrapped. $END$ indicates the position of the caret when the code snippet is complete, and you can no longer press Tab to jump to the next variable. IntelliJ IDEA supports the following predefined live template variables that cannot be modified: Specify whether you want to skip the variable when prompting the user for input if the expression evaluated successfully Specify the default value for cases when the expression fails to evaluate

In the Edit Template Variables dialog, you can do the following for each variable:ĭefine an expression using predefined functions Specify variables in the template text and click Edit Variables…. Select a template where you want to configure variables. In the Settings dialog ( Control+Alt+S), go to Editor | Live Templates. Predefined functions with possible arguments

Names of other variables defined in a live template This expression may contain the following constructs: To add a dollar character $ to the template text so that it is not treated as a variable declaration, use the special variable $$.ĭefine each variable using an expression and provide a default value for cases when the expression fails to evaluate.

In expressions, use variable names without opening and closing dollar characters $, for example, lowercaseAndDash(ComponentName). To declare variables within templates, use the following format: $VAR$. These may be default values that you can modify or values calculated using functions. When you expand a live template abbreviation, its variables either appear as input fields where you can type values or are replaced with values.
