Edit Template Variables dialog
If a live template contains user-defined variables, you can use the Edit Template Variables dialog to configure expressions that define those variables.
Controls
Name | In this field, view or edit the variable name in the format |
Expression | In this field, specify the expression to have the value of the corresponding template input field calculated automatically. This expression may contain the following constructs:
Type an expression manually or select a predefined function from the list. The list shows also the number and type of parameters, if any, for the selected function. The available functions are listed alphabetically in the Functions table. |
Default value | In this field, specify the default string to be entered in the corresponding input field of the expanded template, if the expression does not give any result after calculation. Note that a default value of a variable is an expression that can refer to other live template variables. To define the default value as a literal, enclose it in quotation marks. |
Skip if defined | Select this checkbox to have AppCode proceed with the next input field, if the value of the current input field is defined. |
Move Up / Move Down | Use these buttons to change the order of variables in the list. The order of variables in the table determines the order in which AppCode will switch between the corresponding input fields when the template is expanded. |
Functions used in live template variables
| Returns the characters that indicate the end of a block comment in the current language context. For example, in Swift and Objective-C files it returns |
| Returns the characters that indicate the start of a block comment in the current language context. For example, in Swift and Objective-C files it returns |
| Converts a string into camelCase. For example, |
| Capitalizes the first letter of a string. For example, |
| Capitalizes all the letters of a string, and inserts an underscore between the parts. For example, |
| Returns the name of the current class (where you expand the template). Can be useful for constructor templates. |
| Returns the contents of the system clipboard. |
| Returns all variables of the Sequence type available from the place where the template is expanded. For an example, see the |
| Returns all variables of the AsyncSequence type available from the place where the template is expanded. For an example, see the |
| Returns the characters that indicate the end of a comment in the current language context. For languages with line comments, the return value is empty. |
| Returns the characters that indicate the start of a comment in the current language context. For languages with line comments, the return value is the start of a line comment, same as lineCommentStart(). |
| Invokes code completion at the position of the variable. |
| Invokes smart type completion at the position of the variable. |
| Returns a concatenation of all the strings passed to the function as parameters. For example, |
| Returns the current system date. By default, without a parameter, it returns the date in the current system format. To use a different format, provide a parameter according to the SimpleDateFormat specification. For example, the |
| Returns a list of columns for a table or a view. The |
| Returns a name of a table or a view. The |
| Replaces the first letter of a string with the corresponding lowercase letter. For example, |
| Returns a list of strings suggested for completion when the template expands. For example, |
| Escapes special characters so that the result can be used in a Java string. For example, it replaces the tab character with |
| Returns the name of the current method using the For an example, see the |
| Returns the string format specifier for the object which is passed as a parameter of this function. For an example, see the |
| Returns the names of collections and enumerations available in the current scope. For an example, see the |
| Returns the name of the current file with its extension. |
| Returns the name of the current file without its extension. |
| Returns the absolute path to the current file. |
| Returns the current file path relative to the current project. To check what the relative path is for a given file, right-click it and select Copy Reference, or press Ctrl+Alt+Shift+C. |
| Returns the first word of the string passed as the parameter. For example, |
| Executes the Groovy script passed as a string. The first argument is a string with either the text of the script or the path to the file that contains the script. The function passes other optional arguments to the script as values for The following example shows a
groovyScript("def result = ''; _1.split().eachWithIndex { item, index -> result = result + index.next() + '. ' + item + System.lineSeparator() }; return result;", SELECTION);
|
| Returns the name of the current JavaScript array. |
| Returns the name of the current JavaScript class. |
| Returns the type of the current JavaScript component. |
| Based on the name of the module, returns the parameter from |
| Returns the name of the current JavaScript method. |
| Returns the complete name of the current JavaScript class. |
| The Boolean parameter determines whether constants are allowed or not in the current context. If no parameter is specified, constants are allowed. When the templates expands, a list is shown with |
| Suggests the name for import statements of the type |
| Returns a suggested name for an index variable from most commonly used ones: |
| Returns the suggested name for a variable based on its variable type and initializer expression, according to your code style settings that refer to the variable naming rules. For example, if it is a variable that holds an element within an iteration, AppCode makes a guess on the most reasonable name, taking into account the name of the container that is iterated. |
| Returns the characters that indicate the start of a line comment in the current language context. |
| Returns the current line number. |
| Converts a string into lower case and inserts n-dashes as separators. For example, |
| Returns the list of visible objects that contain member functions, listed as parameters. |
| Finds all occurrences of For example, the |
| Declares the left-side variable with a type of the right-side expression. Some predefined templates in the iterations group use the |
| Returns the parameter details when adding a parameter to a function or method. |
| Converts a string into snake_case. For example, |
| Returns the specified string with spaces as separators. For example, |
| Replaces spaces with underscores in the string passed as the parameter. For example, |
| Returns the substring up to the specified delimiter. This is helpful for removing the extensions in test file names. For example, |
| Returns a suggested name for the index variable in an iteration from most commonly used ones: Some of the predefined templates in the iterations group ( |
| Suggests the name for a variable based on the variable type and its initializer expression, according to your code style settings that refer to the variable naming rules. For example, if it is a variable that holds an element within an iteration, AppCode makes a guess on the most reasonable name taking into account the name of the iterated container. Some of the predefined templates in the iterations group ( |
| Returns the current system time. By default, without a parameter, it returns the time in the current system format. To use a different format, provide a parameter according to the SimpleDateFormat specification. For example, the |
| Transforms a string with underscores (like snake_case) into camelCase. For example, |
| Transforms underscores in a string to spaces. For example, |
| Returns the name of the current user. |
| Returns a variable that is an instance of the object used as a range expression in a loop. |
| Returns a variables that is an instance of the object that contains |
| Returns all variables that may be assigned to the type passed as the parameter. For example, If you pass an empty string |