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

Additional newline is added between if/elif and for loop #1211

Closed
3 tasks
nojaf opened this issue Nov 1, 2020 · 0 comments · Fixed by #1212
Closed
3 tasks

Additional newline is added between if/elif and for loop #1211

nojaf opened this issue Nov 1, 2020 · 0 comments · Fixed by #1212

Comments

@nojaf
Copy link
Contributor

nojaf commented Nov 1, 2020

Issue created from fantomas-online

Code

let a =
        // check if the current # char is part of an define expression
        // if so add to defines
        let captureHashDefine idx =
                if trimmed.StartsWith("#if")
                then defines.Add(processLine "#if" trimmed lineNumber offset)
                elif trimmed.StartsWith("#elseif")
                then defines.Add(processLine "#elseif" trimmed lineNumber offset)
                elif trimmed.StartsWith("#else")
                then defines.Add(processLine "#else" trimmed lineNumber offset)
                elif trimmed.StartsWith("#endif")
                then defines.Add(processLine "#endif" trimmed lineNumber offset)

        for idx in [ 0 .. lastIndex ] do
            let zero = sourceCode.[idx]
            let plusOne = sourceCode.[idx + 1]
            let plusTwo = sourceCode.[idx + 2]
            ()
        

Result

let a =
    // check if the current # char is part of an define expression
    // if so add to defines
    let captureHashDefine idx =
        if trimmed.StartsWith("#if")
        then defines.Add(processLine "#if" trimmed lineNumber offset)
        elif trimmed.StartsWith("#elseif")
        then defines.Add(processLine "#elseif" trimmed lineNumber offset)
        elif trimmed.StartsWith("#else")
        then defines.Add(processLine "#else" trimmed lineNumber offset)
        elif trimmed.StartsWith("#endif")
        then defines.Add(processLine "#endif" trimmed lineNumber offset)


    for idx in [ 0 .. lastIndex ] do
        let zero = sourceCode.[idx]
        let plusOne = sourceCode.[idx + 1]
        let plusTwo = sourceCode.[idx + 2]
        ()

Problem description

Extra line is added because there is no else branch I think.
Might be related to #1187

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 10/26/2020

Default Fantomas configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant