Text and module designer is one of the development tools. It is used to edit the text documents and to edit the software configuration modules.
The text and module designer provides the user with all the main functions required in editing both the simple texts and the texts of software modules. The Designer of 1C:Enterprise 8 uses this designer in two modes:
- to edit the text documents;
- to edit the text of modules (as a part of the form designer).
Editing the text documents
In the mode of text documents editing the designer supports all the standard functions for text editing:
- creation of a new document and opening one of the existing documents;
- typing and editing the text;
- saving the edited text;
- text printing.
During text editing, it is possible to go to a particular document line, move the text blocks on a tab stop, search, replace and use the bookmarks. The bookmarks can be placed on any text line:
In future, a quick transition over the bookmarks is possible using the shortcut keys and menu commands:
Editing the texts of modules
The texts of modules can be edited when creating the form of application solution object, directly when developing the modules of objects or of the entire application and when editing the external text file which contains the module text.
In addition to the standard actions available in any text editor, the text and module designer has a set of specific features:
Highlighting the syntax constructions
For the convenient edition of module texts the designer highlights the script elements: key words, language constants, operators, comments, etc.:
The developer can use the default highlight color or configure them by himself. In general, the system tracks itself the necessity to enable the highlighting mode. However, in situations when the system "does not know" that the module text is edited (for example, if an external text file is edited that contains the module text), the developer can enable the highlighting mode manually using the Designer menu:
Grouping
When viewing the modules, the designer allows merging some syntax language constructions in the groups, collapsing and expanding them. The use of grouping for the syntax constructions makes it easier to perceive the text parts as well as to move and copy the entire groups:
The collapsed text is replaced with a special marker which allows viewing the content of the collapsed group as a hint:
The developer is provided with ability to configure the grouping mode with specifying what syntax constructions can be grouped and what the initial grouping state should be (collapsed or expanded) when opening a document. Thus, he may configure, for example, the use of groupings "to the max ":
Regions
The developer can allocate the arbitrary text regions, group and collapse them just as the instructions of cycles, conditions, procedures and functions are collapsed.
For each text regions allocated by the developer he can give its own name. This allows allocating with a simple and intuitive way the module parts that have a similar meaning.
The regions are allocated using two preprocessor instructions: #Region and #EndRegion. The only purpose of these instructions – to identify the grouped and collapsed module lines.
The regions can be nested into each other or in the other grouped language constructions.
Operations with blocks
The designer allows performing a set of operations with the allocated blocks of module text: automatic formatting, indentation change, adding/removing comments and line breaks.
Module formatting
A good style of writing the modules is to use the syntax indention to extract the control script structures. The designer allows automatically formatting the text on its typing and, in addition, automatic formatting already typed text.
Original text:
Result of automatic formatting:
Increase/decrease of indention
Along with automatic formatting of the entire selected text, the designer supports also the shift operations of the selected block to the right and to the left on a tabulating step.
This simplifies the manual formatting of the large code fragments.
Adding/removing comments
Also the designer contains a very convenient for the developer function of automatic (with one mouse click) adding and removing of the comments for the selected text. This feature is frequently used when debugging the modules:
Adding/removing line break
The use of adding and removing the line break is frequently applied when moving the query texts between the module and, for example, the query console.
Thus, by debugging the query in the query console, the developer can simply copy the query text from the console, paste it in the module and in one movement add a line break to all the lines of query text:
Navigation over the procedures and functions
In a situation when the module has a large number of procedures and functions, it is convenient to use the mode of searching for the procedures which is supported by the designer. The procedures and functions are displayed in a separate window in the order they appear in the module, however, the developer can sort them by A/Z. The widgets to the left of the name refer to the existing procedures and functions, and the names in the angle brackets correspond to the pre-defined procedures that are currently unavailable, but can be placed in this module.
If to set the cursor on the procedure which is still unavailable in the module and click GoTo, the wizard will automatically insert in the module text the header of pre-defined procedure.
Transition to the definition of procedures and functions
The designer allows automatically going to the definition of procedure or function used in the module text. To do this, it is enough to set the cursor on the name of necessary function in the module body and execute the context menu command or click a "hot" key. In the designer window the text of the desired procedure or function will be opened:
Context help
The designer provides a tool of context input of the expressions using the system objects, their properties, methods, etc. During inputting the text or when pressing the shortcut key, the designer outputs the context list which allows selecting the required property, method, function, etc., that allows quickly and correctly typing the texts of modules:
The context help also works for the parameters of some methods, if these parameters are specified by the string literals.
Copying the names of objects and attributes
When typing the module text, the developer can simply drag the names of objects or their attributes from the metadata tree to the necessary module place:
Module checking
The edited module can be checked for the correctness of the use of script syntax constructions, the correctness of the addresses to the methods and object properties "through a point" as well as for the correctness of some parameters of type "String":
If there are the errors in the module, their list is displayed in the status window. By clicking the mouse on the error message, it is possible to go to the module line that caused an error. If desired, the developer can enable an automatic execution of the syntax module control on its closing or saving of entire configuration.
In addition, the Designer supports the full check of all modules contained in the application solution.
During the work with module, the developer can get the context help for the script using the syntax assistant. To do this, it is enough to set the cursor on the language element of interest and by pressing the shortcut key (or using the context menu) to go to the description of this language element in the syntax assistant.
Restriction of module access
For the most of application solution modules it is possible to set the access password that protects the copyright of configuration developer. When attempting to open the protected module, a dialog for entering the password is displayed:
Use of templates
When editing the text documents and modules, the Designer provides the developer with ability to use a mechanism of templates for automatic substitution of the frequently used text fragments.