plibither8 / vscode-remove-comments

🚫 VS Code extension to remove all comments from your code at once — 60+ languages supported
https://marketplace.visualstudio.com/items?itemName=plibither8.remove-comments
MIT License
36 stars 13 forks source link

Support for COBOL, AcuCOBOL and OpenCOBOL #5

Closed spgennard closed 5 years ago

spgennard commented 5 years ago

Hi,

I've some changes to allow COBOL comments to be removed, this includes inline command and line based comments.

Please let us know if you are okay with it and consider merging it.

plibither8 commented 5 years ago

Hi!

This is a big PR with a lot of changes. So first of all, thanks for investing so much of your time into improving this, I'm grateful :smile:.

Now regarding the PR, I see in the diff that there are many other changes than just support for COBOL being added. I have a very busy schedule and won't be able to scrutinise the code itself. So it would be great if you could explain the changes :sweat_smile:. Once I pull your changes and test it on my machine, if all seems right, I'll release the update.

Thanks once again.

Regards

spgennard commented 5 years ago

The code changes are focused arround changing the line based comments.

The code before hand only allowed one line based comment per language, this has been changed to allow more than one type of line based comment per language.

Then, rather than processing the document as one buffer it is done per line to allow easier removal of line based comments.

Next, because COBOL has two types of comments, inline comments using >, very much line // in c++ and the second comments based on a in col 7.

These are line based, so rather than removing to the right they need to have the line removed. So a flag is introduced to ensure this behavour is only done when needed.

Lastly, a warning message was shown in the language is not understood.

Example of LINE based comments:


000100 IDENTIFICATION DIVISION.                                         ST1474.2
000200 PROGRAM-ID.                                                      ST1474.2
000300     ST147A.                                                      ST1474.2
000400****************************************************************  ST1474.2
000500*                                                              *  ST1474.2
000600*    VALIDATION FOR:-                                          *  ST1474.2
000700*                                                              *  ST1474.2
000800*    "ON-SITE VALIDATION, NATIONAL INSTITUTE OF STD & TECH.     ".ST1474.2
000900*                                                              *  ST1474.2
001000*    "COBOL 85 VERSION 4.2, Apr  1993 SSVG                      ".ST1474.2
001100*                                                              *  ST1474.2
001200****************************************************************  ST1474.2

Example of an inline comment:

     display "Hello World".   *> Simpliest inline comment possible :-)
plibither8 commented 5 years ago

Thanks for the explanation :)

I pulled the commits locally, it seems to work fine. Thanks for the changes.

spgennard commented 5 years ago

Thank you, have a good day.