Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The FormattingTreeModifier does not properly format an action statement in Windows #42932

Open
nipunayf opened this issue Jun 14, 2024 · 0 comments

Comments

@nipunayf
Copy link
Contributor

nipunayf commented Jun 14, 2024

Description

Consider the following Java method that takes a Ballerina statement string and formats it:

FormattingTreeModifier treeModifier = new FormattingTreeModifier(FormattingOptions.builder().build(), (LineRange) null);
Node modifiedNode = NodeParser.parseStatement(outputStr).apply(treeModifier);
return modifiedNode.toSourceCode().strip();

Consider the following text being passed to the above method.

json res7 = check foodClient-> get( "/western/apple", {
            "first-header": "first",
            "second-header": "second"
        }) ;

In macOS/Ubuntu, the output is generated as expected, as shown below.

json res7 = check foodClient->get("/western/apple", {
    "first-header": "first",
    "second-header": "second"
});

However, the text is not modified in Windows.

Steps to Reproduce

Pass the following text to the above java method.

json res7 = check foodClient-> get( "/western/apple", {
            "first-header": "first",
            "second-header": "second"
        }) ;

Affected Version(s)

Ballerina 2201.9.0 (Swan Lake Update 9)

OS, DB, other environment details and versions

OS: macOS 14.5 23F79
JDK: openjdk 17.0.8 2023-07-18

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@nipunayf nipunayf changed the title [Bug]: The parseStatement method in the Formatter does not work for a call action in Windows [Bug]: The FormattingTreeModifier does not properly format a call action in Windows Jun 14, 2024
@nipunayf nipunayf changed the title [Bug]: The FormattingTreeModifier does not properly format a call action in Windows [Bug]: The FormattingTreeModifier does not properly format an action statement in Windows Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant