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

Adjust default configuration to be more F# idiomatic #61

Closed
dungpa opened this issue Jul 4, 2013 · 4 comments
Closed

Adjust default configuration to be more F# idiomatic #61

dungpa opened this issue Jul 4, 2013 · 4 comments

Comments

@dungpa
Copy link
Contributor

dungpa commented Jul 4, 2013

@dsyme's suggestions:

  1. Set SpaceBeforeColon = false by default.
  2. Set default PageWidth = 120.

Steps to handle:

@ovatsus
Copy link

ovatsus commented Jul 4, 2013

Should we also have a SpaceAfterColon? Or maybe just SpacesAroundColon to control both? And should those options be global? There's at least 4 different situations I can think of where the colon is used, and I don't think they all fit under the same setting:

  1. Type declaration in records and abstract members: (usually there's spaces around)
type T = {
    A : int
    B : string }

type IFoo =
    abstract Prop : int
  1. Type annotations in return types: (usually there's spaces around)
let xs : int list = []
  1. Type annotations in arguments: (I've seen both spaces around, no spaces around, or just spaces after, I think the more common is the first one)
let replace from to (s:string) = s.Replace(from, to)
let replace from to (s: string) = s.Replace(from, to)
let replace from to (s : string) = s.Replace(from, to)
  1. Giving names to arguments in type declarations in abstract members: (usually there's no spaces around)
type IFoo =
    abstract Foo : s:string * i:int -> unit

@dungpa
Copy link
Contributor Author

dungpa commented Jul 4, 2013

[I responded a few hours ago, but my comment disappeared]

Should we also have a SpaceAfterColon? Or maybe just SpacesAroundColon to control both?

If we use SpacesAroundColon, we have to implicitly assign value 0, 1, 2 and 3 for it. Using SpaceAfterColon is a bit easier.

And should those options be global?

How do we deal with locality? We may split options into categories e.g.

  • Colons in type declarations (case 1 and 4)
  • Colons in arguments' type annotations (case 2 and 3)

To be honest, I'm still puzzled about this option.

@dungpa
Copy link
Contributor Author

dungpa commented Jul 8, 2013

My desire is to have something like this https://github.com/icsharpcode/NRefactory/blob/master/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs#L46 where there are at least a few idiomatic styles to choose from.

Unfortunately there is no such style in F# (and functional programming) yet.

@nojaf
Copy link
Contributor

nojaf commented Jul 12, 2019

PageWidth is now 120 and SpaceBeforeColon is false, see FormatConfig.

@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

4 participants