Commodore
Commodore
774 views

Feature Request: Please add Format Document option

Jump to solution

I regularly hit the Format Document keyboard combination (Menu Item: Edit > Advanced > Format Document <CTRL>+<K>, <CTRL>+<D>) while I'm programming. It usually fixes a lot of code formatting issues and cleanses the code.

Visual COBOL doesn't come with this option yet.

Can we please have this option? It should run the following options from Tools > Options > Text Editor > Micro Focus COBOL ...

  • Advanced ("Place 'System' $set ilusing statements first")
  • Formatting > Indentation
  • Text Casing

jkö

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Our main focus for 5.0 was formatting which we define as any and only changes to whitespace.

In our upcoming release of 6.0, we have two code clean up options to convert word-y operators to symbols, and `IN` to `OF` or `OF` to `IN`. Now that we have our code cleanup framework in place, we can now start to introduce more cleanup features such as case-fixing on top of our pre-existing light bulbs. We have no time frame on this but we will take a note of your suggestions. Please let us know if you have any more specific code cleanup requirements.

We have also prototyped a version that allows the formatting preferences to be stored in a configuration file that can be shared via source control, as well as a command line tool to format source files. We have taken a note of your suggestion and we will consider adding this to the product in the future.

In the meantime, formatting preferences can be shared using Visual Studio settings import / export.

Thanks,
Ted

View solution in original post

5 Replies
Commodore
Commodore

... I don't seem to be able to edit my message after submitting it, so I'd like to suggest a few additional formatting options to Tools > Options > Text Editor > Micro Focus COBOL > Advanced that could be useful for the suggested Format Document option:

----------------------------------------------
□  Indent Sections
□  Indent Paragraphs
□  Indent Declarations/Sentences
----------------------------------------------
□  Segregate divisions by empty line
----------------------------------------------

These suggested settings are all supposed to be independent Boolean options.

.

When hitting Format Document, the resulting code formatting style would then result in code formatting results depicted by the images I attached to this message (I hope this forum will allow me to add them.)

0 Likes
Micro Focus Expert
Micro Focus Expert

Hi,

The 5.0 product for Visual COBOL adds support for formatting code in the editor. https://www.microfocus.com/documentation/visual-cobol/vc50/VS2019/GUID-EA298C66-A750-407F-AA55-46F6ED73B6B7.html

Commodore
Commodore

You are right.

I installed the latest version of Visual COBOL yesterday. For some reason I didn't see the Edit > Advanced sub menu item yesterday for the COBOL source file. Today I noticed it uses keyboard shortcuts different from Microsofts', so hitting <CTRL>+<K>, <CTRL>+<D> didn't work, too, when I tried yesterday.

Yet, fiddling around with this option today I noticed that the Format Code menu items don't fix all formatting. They just deal with intention, as far as I can see. Format Code doesn't update keyword text capitalization, for instance.

You know, I'm coming from a colaborative team background. The current trend for homogenizing existing code across team members (see EditorConfig and Code Cleanup) enables team members to follow their own coding style, having Visual Studio (Code) amend any existing code file to a programmer's individual code formatting style using the Format Document menu items. - In case of COBOL this would also include keyword capitalization, I presume.

0 Likes
Commodore
Commodore
... "intention" should have read "indention"
0 Likes
Micro Focus Expert
Micro Focus Expert

Our main focus for 5.0 was formatting which we define as any and only changes to whitespace.

In our upcoming release of 6.0, we have two code clean up options to convert word-y operators to symbols, and `IN` to `OF` or `OF` to `IN`. Now that we have our code cleanup framework in place, we can now start to introduce more cleanup features such as case-fixing on top of our pre-existing light bulbs. We have no time frame on this but we will take a note of your suggestions. Please let us know if you have any more specific code cleanup requirements.

We have also prototyped a version that allows the formatting preferences to be stored in a configuration file that can be shared via source control, as well as a command line tool to format source files. We have taken a note of your suggestion and we will consider adding this to the product in the future.

In the meantime, formatting preferences can be shared using Visual Studio settings import / export.

Thanks,
Ted

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.