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

Trivia before elif generates invalid code due to missing indentation #527

Closed
smoothdeveloper opened this issue Oct 20, 2019 · 0 comments
Closed

Comments

@smoothdeveloper
Copy link
Contributor

smoothdeveloper commented Oct 20, 2019

Issue created from fantomas-ui

Code

let a ex =
    if null = ex then
        None
        
    elif ex.GetType() = typeof<obj> then
        Some ex
    else
        None

Error

let a ex =
    if null = ex then None
    elif

    ex.GetType() = typeof<obj> then Some ex
    else None

Options

Fantomas Next - 3.0.0-10/19/2019

Name Value
IndentOnTryWith false
IndentSpaceNum 4
KeepNewlineAfter true
PageWidth 120
ReorderOpenDeclaration false
SemicolonAtEndOfLine false
SpaceAfterComma true
SpaceAfterSemicolon true
SpaceAroundDelimiter true
SpaceBeforeArgument true
SpaceBeforeColon false
StrictMode false

More information

Trivia surounding if/elif/else constructs tend to mess with indentation of the condition expression, the initial fix would be to prepend that condition with one indentation level.

A larger problem is that location of trivia such as comments or even empty lines may vary depending styles, but Fantomas seems to take the trivii and put them inside the node.

See:
sample with comments at many places

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

No branches or pull requests

1 participant