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

Maintain column indentation for list of functions #2446

Merged
merged 8 commits into from Aug 24, 2022

Conversation

cgravill
Copy link
Member

Fixes #2158

I wasn't sure about the added duplication in IndexWithoutDotExpr but factoring the change seemed to add as much complexity. Elsewhere seems to favour mild duplication. Happy to adjust as preferred.

Noticed in the ListTests.fs file the last function isn't marked as a test. I've checked and it runs fine. I have NOT added it to this PR but happy to or add a separate PR to get properly added and running:

let ``remove space between array type and square brackets, 2192`` () =
formatSourceString
false
"""
let x: int [] = [ 1, 2, 3 ]
let x: double [] [] = [ [ 1.0, 2.0, 3.0 ] ]
let foo (x: double []) (y: object [] []) : string [,] = x :> int []
let foo<'T> (x: 'T []) = x
"""
config
|> prepend newline
|> should
equal
"""
let x: int[] = [ 1, 2, 3 ]
let x: double[][] = [ [ 1.0, 2.0, 3.0 ] ]
let foo (x: double[]) (y: object[][]) : string[,] = x :> int[]
let foo<'T> (x: 'T[]) = x
"""

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks, @cgravill for picking this up!

Would you mind adding in a Changelog entry?
https://github.com/fsprojects/fantomas/blob/master/CONTRIBUTING.md#changelog
You will probably need to add the Unreleased header section.
And please include all duplicate issues in the changelog:

There is no need to add tests for these duplicates as people should have added a space in the first place. But I'm considering all these closed and it should be recorded in the change log.

src/Fantomas.Core/CodePrinter.fs Outdated Show resolved Hide resolved
src/Fantomas.Core.Tests/ListTests.fs Outdated Show resolved Hide resolved
Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, thanks for your patience.

src/Fantomas.Core/CodePrinter.fs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
## [Unreleased]

### Fixed
* Maintain column indentation for list of functions. [#2158](https://github.com/fsprojects/fantomas/issues/2158) duplicates: [#2195](https://github.com/fsprojects/fantomas/issues/2195), [#2201](https://github.com/fsprojects/fantomas/issues/2201), [#2242](https://github.com/fsprojects/fantomas/issues/2242), [#2392](https://github.com/fsprojects/fantomas/issues/2392)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the title of the issue instead of the title of the PR.
Similar to all the examples below.
And put each issue on its own line, the duplicates: is also somewhat strange compared to the rest.
Thanks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done. I've not explicitly tested the others (as you requested above), but I've put them all on a separate line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add them all to the fixes magic command?

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks, @cgravill!

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 this pull request may close these issues.

List of functions misaligned and breaks (Elmish)
2 participants