BrianGarland / vscode-rpgfree

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

Selection Should be Extended to Select Full Line(s) of Code #90

Closed BrianGodsend closed 1 year ago

BrianGodsend commented 1 year ago

The Convert to Free Format is designed to convert entire line(s) of code, not selected characters. If the last line is only partially selected, the remaining text on that line will be appended to the converted source. This is likely not desirable and will cause the last line of the converted source to be malformed.

So, if conversion is requested with some text being selected, the selection should adjust the selection range to start at the beginning of the first selected line and extend to the end of the last selected line.

Fixed format RPG:

      * Select from start to end of subfield, `myfld`, then convert
     d myDs            ds                  qualified  
     d  myfld                         3a

Wrong output:

        // Select from start to end of subfield, `myfld`, then convert
       Dcl-DS myDs  qualified;
         myfld;                         3a

Expected output:

       // Select from start to end of subfield, `myfld`, then convert
       Dcl-DS myDs  qualified;
         myfld          Char(3);
       End-DS;

Note: In the examples above the **FREE was not added because we made a selection prior to converting the code.