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

Fantomas removes module and namespace if it is only 1 word (without dots) #380

Closed
zakaluka opened this issue Dec 8, 2018 · 2 comments
Closed

Comments

@zakaluka
Copy link
Contributor

zakaluka commented Dec 8, 2018

Description

Fantomas removes the module and namespace lines if they are the first line in the file AND they don't contain any dots.

However, if the module or namespace contains dots (e.g. Shared.Utility), the line is not removed.

This happens when using formatCode in a FAKE build.fsx file.

Options:

// Common Fantomas Config to reformat files and check that formatting complies
let fantomasConfig =
    { FormatConfig.Default with
        StrictMode = true
        IndentSpaceNum = 2
        SpaceBeforeColon = false
    }

Repro code

Incorrect

Input:

namespace Shared

type Counter = int

Output:

type Counter = int

Expected:

namespace Shared

type Counter = int

But this works okay

Input:

module ZenCase.Shared.Utility

/// Allows debugging output without breaking function chains
let tee f x = f x |> ignore; x

Output:

module ZenCase.Shared.Utility

/// Allows debugging output without breaking function chains
let tee f x =
  f x |> ignore
  x

http://ratatosk.dynu.net/fantomas/#?code=HYQwtgpgzgDiDGEAEBlAFiAThAJgWAChCAXATxmQGEB7AV2GIkyQF4kBLBwwoA&config=N4IgkgdgJgphAuBlADgQwMYwHIFcC2IAXACwA0IACqgOYwDqAllPABZEAcADORQE4wBnGLwBuMAKLQA8gDMAMgwgwiM1ABsh5RDDwN0AezX6IAQXiSoshUpXrNIFBhgAhGDP38Tvavjjwi8Lw4MFpomK7u-ADChsYBQSEOYTAmMvDCMXh4qPHBoU6p6bzaugZGELmJkLAIUhAAKrwAnoysthqJAEowHrC8UshwACIw6GqovKjwDHGEqh35mF76ONAjagy6RZVagXrwALL6sO1CAL5AA

NOTE: This work correctly online, but not when part of the FAKE pipeline.

EDIT: Matched config with the options from build.fsx. Despite that, it will works correctly online.
http://ratatosk.dynu.net/fantomas/#?code=HYQwtgpgzgDiDGEAEBlAFiAThAJgWAChCAXATxmQGEB7AV2GIkyQF4kBLBwwoA&config=N4IgkgdgJgphAuBlADgQwMYwHIFcC2IAXAEwA0IACqgOYwDqAllPABZEAcADORQE4wBnGLwBuMAKLQA8gDMAMgwgwiM1ABsh5RDDwN0AezX6IAQXiSoshUpXrNIFBhgAhGDP38Tvavjjwi8Lw4MFpomK7u-ADChsa2GiEOYTAmMvDCMXh4qAFBiY6Yqem82roGRhC5weSQsAhSEAAqvACejKzx9gBKMB6wvFLIcAAiMOhqqLyo8AxxhKoJoU5e+jjQo2oMusVV+YF68ACy+rC7AL5AA

@zakaluka zakaluka changed the title Fantomas removes module and namespace if it is only 1 work (without dots) Fantomas removes module and namespace if it is only 1 word (without dots) Dec 8, 2018
nojaf added a commit that referenced this issue Jul 10, 2019
@nojaf
Copy link
Contributor

nojaf commented Jul 10, 2019

Hi, I did an attempt to reproduce this in 097bbca.
I don't think this is an issue anymore. What version of fantomas are you here?

nojaf added a commit that referenced this issue Jul 11, 2019
@nojaf
Copy link
Contributor

nojaf commented Jul 12, 2019

Please reopen if the problem still occurs with the latest beta.

@nojaf nojaf closed this as completed Jul 12, 2019
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

3 participants