Variables are suggested on several Cobol commands, such as move, if, subtract, add and others. Constants are also considered, each one appearing with a different icon on IntelliSense.
This extension suggests paragraphs based on what is typed on perform clause. Notice that it also parses a java-like documentation for paragraphs, as follows.
When mouse is over some Cobol keywords, the related keywords are highlighted for better understanding.
You can also peek Cobol variable and paragraph definitions!
The Language Server provides automatic formatting for several Cobol clauses as shown below:
The variable declaration is done in two steps so that the extension parses the picture and generates the most approprivate VALUE in the VALUE clause:
- If it's a numeric display variable (picture contains ., z, b, - or ,) inserts VALUE IS ZEROS.
- If it's a numeric variable for computing, with decimal v or negative s, inserts VALUE IS ZEROS COMP.
- If it's an alphanumeric variable inserts VALUE IS SPACES.
- If it's a variable for computing, without decimal v nor negative s, inserts VALUE IS ZEROS COMP-X.
This extension provides by default several snippets related to Cobol functions/commands to make typing easier and faster. Besides, user can add personal snippets and even filter the filename with a RegEx, making them only appear to specific groups of files.
First of all, configure the directory where specific JSON snippets are located:
"rech.editor.cobol.snippetsRepositories": [
"F:\\MySnippets"
]
Second, create one or more JSON files following the example below. This example adds two snippets for files with name containing WREG.
{
"conditions": {
"sourceFileNameRegex": ".*WREG.*"
},
"snippets": [
{
"prefix": "My first snippet",
"body": "This will appear in editor when snippet is selected",
"description": "Description of my snippet"
},
{
"prefix": "My second snippet",
"body": "This is the body of my second snippet with ${0:placeholder}",
"description": "Description of second snippet"
}
]
}
Snippet placeholders are also supported.
This extension is designed for Cobol code developed with FREE FORMAT style, and is not fully prepared for FIXED FORMAT. Comment lines are treated as *> and not as * which is typically used in FIXED mode.