Feature Request: Prevent Line Breaks in 'for' Loop Formatting
Subject: Request to maintain single-line formatting for 'for' loops during document formatting.
1. Description
Currently, the "Format Document" feature in the editor incorrectly inserts line breaks within 'for' loop headers. This significantly reduces code readability and breaks from standard coding conventions found in modern IDEs.
2. Current Behavior (Failure Scenarios)
When the auto-formatter is triggered, it splits a single-line 'for' loop into multiple, fragmented lines as shown below:
Scenario 1 (Simplified for-loop):
Scenario 2 (Standard C-style for-loop):
for(i = 0;
i < count;
i++)
3. Expected Behavior
The formatter should preserve the integrity of the loop header. Ideally, the parameters within the parentheses should remain on a single line:
Correct Format Example:
for (i from 0; count) {
// code
}
Standard Format Example:
for (int i = 0; i < count; i++) {
// code
}
4. Requested Change
- Header Preservation: Update the formatting logic to treat everything inside the 'for' parentheses as a single logical unit that should not be wrapped.
- Smart Wrapping: Only apply line breaks if the entire statement exceeds a defined maximum line length (e.g., 100+ characters), otherwise, keep it on one line.
- Consistency: Align the formatter behavior with industry standards like Prettier, Clang-Format, or the VS Code default formatter.
5. Why this is needed
- Readability: 'for' loops are core logic structures; breaking them into 3-4 lines makes it much harder for developers to scan the code quickly.
- Professionalism: A predictable formatter encourages developers to use the tool. Current behavior forces users to manually "fix" the formatting back to a single line.
Thank you for your time and for considering this improvement to the cgscript developer environment!
Feature Request: Prevent Line Breaks in 'for' Loop Formatting
Subject: Request to maintain single-line formatting for 'for' loops during document formatting.
1. Description
Currently, the "Format Document" feature in the editor incorrectly inserts line breaks within 'for' loop headers. This significantly reduces code readability and breaks from standard coding conventions found in modern IDEs.
2. Current Behavior (Failure Scenarios)
When the auto-formatter is triggered, it splits a single-line 'for' loop into multiple, fragmented lines as shown below:
Scenario 1 (Simplified for-loop):
Scenario 2 (Standard C-style for-loop):
3. Expected Behavior
The formatter should preserve the integrity of the loop header. Ideally, the parameters within the parentheses should remain on a single line:
Correct Format Example:
Standard Format Example:
4. Requested Change
5. Why this is needed
Thank you for your time and for considering this improvement to the cgscript developer environment!