Code completion for rules
Contents |
Code completion on the “Rules” tab enables all the tags and corresponding parameters (plus values) that are available for the rule definition in the current syntactic context to be shown and inserted at the insert mark on the Rules tab with a keystroke.
If the required tags, parameters, or values have already been declared, the first letter or letters can be entered. Press Ctrl + Space to reduce the number of inputs available for selection or add the input directly. If possible, mandatory parameters are also added directly at the same time.
In FirstSpirit version 5.2R2 and higher, the list of suggestions can be filtered and/or searched by entering text. See the introduction page for more information.
![](../code-completion-3.png)
The insert mark must be positioned after an opening <RULES> tag.
Notes
Only the tags, parameters, and keywords that are valid for the selected tag or the selected parameter are ever displayed. Tags or parameters that are already in use for the current rule definition and can only be used once are removed from the list.
![]() |
Crossed-out entries in the list are old (“deprecated”) and should not be used. |
In order to be able to show and select the available tags, parameters, and keywords, the insert mark must be positioned as follows depending on rule syntax:
1) Tags
To display and add tags between opening or closing and opening tags, an angle bracket must be opened before the insert mark (<). Press Ctrl + Space to open the list of suggestions with the available tags.
Example:
The following DO / VALIDATION definition already exists:
<RULES>
<RULE>
<DO>
<VALIDATION>
<PROPERTY name="VALID" source="st_headline"/>
</VALIDATION>
</DO>
</RULE>
</RULES>
To add the MESSAGE tag, an angle bracket must be opened in the corresponding position (<, after PROPERTY in the following example, on the 5th line):
<RULES>
<RULE>
<DO>
<VALIDATION>
<PROPERTY name="VALID" source="st_headline"/> <
</VALIDATION>
</DO>
</RULE>
</RULES>
When the MESSAGE tag is selected from the list of suggestions opened with Ctrl + Space, the tag is added as follows along with the mandatory parameters lang and text:
<RULES>
<RULE>
<DO>
<VALIDATION>
<PROPERTY name="VALID" source="st_headline"/> <MESSAGE lang="" text="" />
</VALIDATION>
</DO>
</RULE>
</RULES>
The values for lang and text can now be entered between the quotation marks. The insert mark is already in the correct position. See also section 3) Values for more information.
2) Parameters
In order to be able to display and add parameters inside an opening tag, there must be a blank space before and possibly after the insert mark.
Example:
The INFO restriction level applies for the above example, because scope is not declared. To set the restriction level to SAVE the SAVE value must be added to the scope parameter in the VALIDATION tag. To do this, insert a blank space in front of the closing angle bracket > in the VALIDATION tag and position the insert mark after the blank space (on the 4th line in the example below):
<RULES>
<RULE>
<DO>
<VALIDATION >
<PROPERTY name="VALID" source="st_headline"/>
<MESSAGE lang="*" text="A Headline must be provided!"/>
</VALIDATION>
</DO>
</RULE>
</RULES>
Since only the scope parameter is available in the VALIDATION tag, it is added directly at the insert mark by pressing Ctrl + Space. The three available values INFO, RELEASE, and SAVE are displayed directly in a list of suggestions. If SAVE is selected, the code is updated as follows:
<RULES>
<RULE>
<DO>
<VALIDATION scope="SAVE">
<PROPERTY name="VALID" source="st_headline"/>
<MESSAGE lang="*" text="A Headline must be provided!"/>
</VALIDATION>
</DO>
</RULE>
</RULES>
3) Values
In order to be able to display and add values prescribed by FirstSpirit (“keywords”) or even input component identifiers that have already been defined on the form tab for a parameter, the insert mark must be positioned inside the quotation marks.
Example:
The mandatory attribute “source” in the PROPERTY tag is used to reference individual components or the entire form. In order to be able to display the input components defined on the form tab with code completion, the insert mark must be positioned inside the quotation marks.
Press Ctrl + Space to open a list of suggestions with the available input component identifiers. They are displayed in alphabetical order.