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

Long function signature #4

Closed
nojaf opened this issue Jun 3, 2020 · 2 comments · Fixed by #5
Closed

Long function signature #4

nojaf opened this issue Jun 3, 2020 · 2 comments · Fixed by #5

Comments

@nojaf
Copy link
Contributor

nojaf commented Jun 3, 2020

I'm not entirely sure about this one but here goes:

To tackle fsprojects/fantomas#495, if I remember correctly, we internally aligned on how the GR way of solving this bug would be.
I think the part of having the = on a separate line was proposed by you folks.
Could we add a section on how long functions should be formatted?

The thing I'm after here is to know what the rule is about indenting the rest of the function after the function name.

For example:

let someName
    (a : int)
    (b : int)
    : int
    =
    // start of function
    a + b

My question is about the spaces before (a : int), are they one indentation length (4 spaces in this example), or do the align the start of someName?
If the indentation is 4 spaces they are one and the same.
Related Fantomas bug: fsprojects/fantomas#883

@Smaug123
Copy link
Contributor

Smaug123 commented Jun 5, 2020

I'd never really thought about it, but I think it's one indentation length (assuming that actually compiles).

@nojaf
Copy link
Contributor Author

nojaf commented Jun 5, 2020

Yes, it compiles:
image

So I'm guessing the fix in Fantomas should be focussed on one indentation.

I opened the question on how to format long signatures at the Microsoft style guide.
They might see things differently than how GR would do it.
So maybe it is a good idea to add this guide as well?

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

Successfully merging a pull request may close this issue.

2 participants