BrianGarland / vscode-rpgfree

Visual Studio Code extension to convert fixed format RPGLE to free format
MIT License
19 stars 11 forks source link

Apply case to post conversion text #63

Open m-tyler opened 1 year ago

m-tyler commented 1 year ago

How difficult could it be to create a category of post-conversion categories so that I can tell you to Upper, Lower, or Title case those items during conversion?

So, if I have all upper case code.

     FPRP02FM   CF   E             WORKSTN
     F                                     INFDS(INFDS)
     F                                     MAXDEV(*FILE)
     FPRPLPNPF  UF A E           K DISK

v0.0.24 casing conversion

       Dcl-F PRP02FM WORKSTN INFDS(INFDS) MAXDEV(*FILE);
       Dcl-F PRPLPNPF Usage(*Update:*Delete:*Output) Keyed;

I want the item names and keywords to be in title case and the special values to be upper. (proposed post conversion casing)

       Dcl-F PRP02FM Workstn Infds(Infds) Maxdev(*FILE); //<-- keywords chg to title case
       Dcl-F PRPLPNPF Usage(*UPDATE:*DELETE:*OUTPUT) Keyed; // <-- Speical characters chg to upper case

I noticed that there seems to be a list somewhere already. I don't propose adding in any difficult conversion context like camel casing. Maybe there is a way to use the built-in VS Code editor conversion actions.

Categories, I would like be able to specify the casing option.

  1. Special words, like UPDATE, ON, *INxx, (anything with a leading asterisk)
  2. BIFs, these are already converted using the linter feature of Code for IBM i but it would be nice to have them done right after conversion.
  3. Language keywords. These would be assumed from the language manual and would be converted if the whole word is found.
  4. Skip case conversion in comments
  5. Skip case conversion in constants (if possible/easy)

Thanks for considering this.

BrianGodsend commented 1 year ago

When the Code for IBM i and RPGLE Language Tools extensions are in use, once a document is converted to free format, the Format Document function will automatically be called. One may also manually trigger the formatting using Shift+Alt+F. The RPGLE linter that is part of the RPGLE Language Tools already has settings to control the casing of various parts of source.

Rather than add (duplicate) functionality here, perhaps it would be better to address any missing functionality in the RPGLE Language Tools.