IBM / vscode-clle

VSCode extension for CLLE language support
Apache License 2.0
12 stars 1 forks source link

Feature Request: CL Language Formatter #7

Open JDubbTX opened 1 year ago

JDubbTX commented 1 year ago

Please provide format capabilities similar to what the RPGLE language provides.

The CL Formatter should: 1) Have configurations for label position, command starting position, and command continuation start position. 2) Allow for adjusting the line length 2) Automatically handle placement of continuation characters.

Allow for formatting of a single CL command, multiple CL commands, or an entire document.

Reason for request: Currently CL programming in VSCODE is somewhat of a pain compared to other platforms such as RDi, or even PDM (greenscreen). Both of these platforms allow for prompting a CL command, and after prompting the CL command is properly formatted. RDi has automatic formatting capability as you type. Conversely, In VSCODE, manual placement of the continuation character is required, as well as proper indentation, etc.

It is common practice in PDM to 'prompt - F4' and then immediately press 'enter' on a CL command just for the formatting capabilities. For context or inspiration, here is a screenshot of what RDi provides for CL language formatting and controls:

image

jkyeung commented 1 year ago

It's cool to see the configurability RDi provides. I definitely am in favor of replicating (if not even somehow improving on) that. I understand and appreciate the practice of (mindlessly) using F4, Enter to normalize formatting. There's definitely value to normalization.

But I welcome any facility that will encourage something more readable. Like lines starting at or near the left edge, with sensible indentation of nested code. A wall of unnecessarily short lines, with line breaks at semantically awkward places, is less than ideal in my opinion. One can dream of a time when everyone is using VS Code, Merlin, or RDi, and shops start to standardize new code on a more **FREE-like style of formatting.

That being said, I think it is important to be able to easily (with a single button or checkbox) set the configuration so that it exactly mimics what SEU does.

JDubbTX commented 1 year ago

I like the thought of starting cl code in the left most position, but then when you are editing source with labels its nice to have those labels be in a left margin. I'm kinda on the fence on this. I tried writing a cl program in a totally freeform way. While it works, its not visually appealing to have the labels in the same start position as unlabeled code.

edmundreinhardt commented 1 year ago

So should the indent be only as much as the longest label?

jkyeung commented 1 year ago

I think accommodating labels in their own space on the left is a reasonable thing to do. Looks like RDi provides sufficient configurability in that regard. No reason VS Code couldn't do the same.

ThomasBarberot commented 1 year ago

Beginning the code on the first left column is a good solution, and in RDi, I put the label on the previous line of the command, and in a different color. So I think it totally readable in this way. RDi - CL