Syntax highlighting for COBOL, JCL, PL/I and MF directive files.
An Integrated Development Environment for COBOL.
Quick viewing of COBOL source and edit.
Everywhere Visual Studio Code works.. aka Windows, Linux and Mac OSX.
Keys | Description |
---|---|
ctrl+alt+p | Goto procedure division |
ctrl+alt+w | Goto working-storage section |
ctrl+alt+d | Goto data division (or working-storage section if not present) |
ctrl+alt+, | Go backwards to next section/division |
ctrl+alt+. | Go forward to next next section/division |
f12 or ctrl+click | Move to copybook/file |
ctrl+hover over copybook | Peek head of copybook |
right mouse/peek | Peek copybook without opening the file) |
- COBOL tab stops can be changed by editing the coboleditor.tabstops setting.
- Extensions used for move to copybook, can be changed by editting the coboleditor.copybookexts settings.
- Directories used for move to copybook, can be changed by editting the coboleditor.copybookdirs settings.
Visual Studio code can be setup to build your COBOL source code.
MsBuild based projects can be consumed as build task, allowing navigation to error/warnings when they occur.
Below is an example of build task that uses mycobolproject.sln.
{
"version": "2.0.0",
"tasks": [ {
"label": "build",
"type": "shell",
"command": "msbuild",
"args": [
"/property:GenerateFullPaths=true",
"/t:build",
"mycobolproject.sln"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always"
},
"problemMatcher": "$mfcobol-msbuild"
}
]
}
The example below shows you how you can create a single task to compile one program using the cobol
command.
{
"label": "mf cobol (single file)",
"command": "cobol",
"args": [
"${file}",
"noint",
"nognt",
"noobj",
"noquery",
"errformat(3)",
"COPYPATH($COBCPY;${workspaceFolder}\\CopyBooks;${workspaceFolder}\\CopyBooks\\Public)",
";"
],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceRoot}"
},
"presentation": {
"echo": true,
"reveal": "never",
"focus": true,
"panel": "dedicated"
},
"problemMatcher": "$mfcobol-errformat3"
}
The example below shows you how you can create a single task to compile one program using the cobol
command.
{
"label": "mf cobol (single file)",
"command": "cobol",
"args": [
"${file}",
"noint",
"nognt",
"noobj",
"noquery",
"errformat(2)",
"COPYPATH($COBCPY;${workspaceFolder}\\CopyBooks;${workspaceFolder}\\CopyBooks\\Public)",
";"
],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceRoot}"
},
"presentation": {
"echo": true,
"reveal": "never",
"focus": true,
"panel": "dedicated"
},
"problemMatcher": "$mfcobol-errformat2"
}
The example below shows you how you can create a single task to compile one program using the cobc
command.
{
"version": "2.0.0",
"tasks": [
{
"label": "gnucobol - cobc (single file)",
"type": "shell",
"command": "cobc",
"args": [
"-fsyntax-only",
"-I${workspaceFolder}\\CopyBooks",
"-I${workspaceFolder}\\CopyBooks\\Public",
"${file}"
],
"problemMatcher" : "$gnucobol-cobc"
}
]
}
The example below shows you how you can create a single task to compile one program using the ccbl32
command.
{
"version": "2.0.0",
"tasks": [
{
"label": "acu cobol - ccbl32 (single file)",
"type": "shell",
"command": "%ACUCOBOL%\\bin\\ccbl32",
"args": [
"-Sp", "${workspaceFolder}\\CopyBooks",
"-Sp", "${workspaceFolder}\\CopyBooks\\Public",
"${file}"
],
"windows": {
"options": {
"env": {
"ACUCOBOL" : "C:\\extend10.1.1\\AcuGT"
}
}
},
"problemMatcher" : "$acucobol-ccbl"
}
]
}
ToDo tree by Gruntfuggly
Although this extension does not understand comments in COBOL source files, it can be made to by adding the following user setting:
{
"todo-tree.flat": false,
"todo-tree.expanded": true,
"todo-tree.regex": "((//|#|<!--|;|/\\*|\\*>|^......\\*)\\s*($TAGS)|^\\s*- \\[ \\])",
"todo-tree.tags": [
"TODO",
"FIXME",
"!FIXME",
"CHANGED",
"BUG",
"NOTE"
],
"todo-tree.filterCaseSensitive": true,
"todo-tree.iconColours": {
"FIXME" : "#A188FF",
"!FIXME" : "red",
"NOTE" : "blue",
"TODO" : "cyan",
"CHANGED" : "yellow",
"BUG" : "red"
}
}
When coboleditor.margin
is enabled extension will look for "sourceformat" settings in the header of the source file itself.
However, if you need to tell the extension which file are which particular format, this can be achieved with coboleditor.fileformat
property.
For example, if you want all the files that match A*.cbl
to be fixed and every other *.cbl is free format, you can then use:
"coboleditor.fileformat": [
{
"pattern": "**/A*.cbl",
"sourceformat": "fixed"
},
{
"pattern": "**/*.cbl",
"sourceformat": "free"
}
],
The defaults embedded in the extension can be overwritten by either changing sessions at the user level in the settings json or more efficiently, you change it just for the "COBOL" files.
For example, to ensure you use utf8 for all you files use:
{
"[COBOL]": {
"files.encoding": "utf8",
"files.autoGuessEncoding": false
}
}
- [ALT] + [SHIFT] + [C]: Change to COBOL Syntax (default)
- [ALT] + [SHIFT] + [A]: Change to ACUCOBOL-GT Syntax
- [ALT] + [SHIFT] + [O]: Change to OpenCOBOL Syntax
- [ALT] + [SHIFT] + [G]: Change to GnuCOBOL Syntax
- [ALT] + [SHIFT] + [M]: Toggle margins (overrides user/workspace settings)
I would like to thank the follow contributors for providing patches, fixes, kind words of wisdom and enhancements.
- Ted John of Berkshire, UK
- Kevin Abel of Lincoln, NE, USA
- Simon Sobisch of Germany