You need to use the Visual Studio Code Snippets Manager (click here) to manage code snippets and to create new custom ones. Do not edit the snippets directly in their default installation folder. Any changes you make in that location will be reverted and lost if you later install an upgrade to Visual COBOL such as a Patch Update release. Following the Microsoft procedure ensures that the snippets will be handled correctly during a Patch Update install.
The following instructions are for creating a standard COBOL snippet file:
See the Visual Studio Help for instructions.
See the MSDN Code Snippet Schema Reference.
See How to: Manage Code Snippets in the Visual Studio Help.
When inserting a snippet, the editor automatically indents it into the code area, taking care of where the margin for the source file is according to its source format.
You can use Micro Focus-specific snippet functions to define snippets which use the left margin. You add the function at the start of each line that needs offsetting.
If any of these functions are used in the snippet, the default margin auto-indent is not applied.
Function | Behavior |
---|---|
MFOffsetLeftMargin() | Inserts the following number of white spaces to pad the left margin:
|
MFMarginComment () | Inserts a comment marker in the indicator column. |
MFOffsetToIndicatorCol() | Inserts the following number of white spaces to pad to column before the indicator column:
|
The following example shows the code for a typical snippet:
... <Code Language="COBOL"> display "My snippet contents" </Code> ...
The following example demonstrates the use of Micro Focus-specific snippet functions:
... <Declarations> <Literal Editable="false"> <ID>offsetMargin</ID> <Function>MFOffsetLeftMargin()</Function> <Default/> </Literal> <Literal Editable="false"> <ID>marginComment</ID> <Function>MFMarginComment()</Function> <Default/> </Literal> </Declarations> <Code Language="COBOL" Delimiter="~"> ~marginComment~My snippet comment ~offsetMargin~display "Hello World" </Code> ...