The redscript formatter is exhibiting unintended behavior when handling comments placed within a function's body. Instead of preserving the comments' original placement, the formatter moves them outside of the function block, which can alter the code's readability and intended documentation.
Steps to Reproduce:
- Create a redscript file with the following code:
func Test() {
1 + 2;
// Comment 1
// Comment 2
}
- Run the redscript formatter on this file.
Expected Behavior:
The formatter should preserve the comments' position within the function, resulting in the following code:
func Test() {
1 + 2;
// Comment 1
// Comment 2
}
Actual Behavior:
The formatter incorrectly moves the comments to after the function block, producing this output:
func Test() {
1 + 2;
}
// Comment 1
// Comment 2
The redscript formatter is exhibiting unintended behavior when handling comments placed within a function's body. Instead of preserving the comments' original placement, the formatter moves them outside of the function block, which can alter the code's readability and intended documentation.
Steps to Reproduce:
Expected Behavior:
The formatter should preserve the comments' position within the function, resulting in the following code:
Actual Behavior:
The formatter incorrectly moves the comments to after the function block, producing this output: