-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Draft: Format .cabal files with cabal-gild #4229
base: master
Are you sure you want to change the base?
Conversation
ghc-options: | ||
-threaded | ||
-- allow user RTS overrides |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad comment placement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made an issue: tfausak/cabal-gild#70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not a blocker, we can move these comments above the field and clarify
b3b4bd4
to
dff31ba
Compare
directory, | ||
extra, | ||
filepath, | ||
ghcide ==2.8.0.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more reason I prefer cabal-gild, is that it doesn't try to preserve version constraint indentation.
This leads to more diff friendly format (adding/removing dependency with longer than longest name, doesn't lead to indentation changes for other version constraints)
e.g.
short >=1.0
longer >= 2.0 < Adding longer dependency re-indents version constraint for shorter, which makes for longer diffs
can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 I'm the author/maintainer of Gild. Let me know if I can do anything to help here!
ghcide/ghcide.cabal
Outdated
copyright: Digital Asset and Ghcide contributors 2018-2020 | ||
synopsis: The core of an IDE | ||
description: A library for building Haskell IDE's on top of the GHC API. | ||
homepage: https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which version of Gild was used here? As of 1.2.0.0 it shouldn't have re-formatted this line. (The URL should've stayed on its own line after homepage:
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.1.1.0 was used, will reformat with 1.2.0.0, thanks for the hint!
, unordered-containers >=0.2.10.0 | ||
, vector | ||
Diff ^>=0.4.0, | ||
Glob, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to make Gild sort things case sensitively, but I'm not set on it. See tfausak/cabal-gild#46.
unliftio >=0.2.6, | ||
unliftio-core, | ||
unordered-containers >=0.2.10.0, | ||
vector, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of noise here from switching to trailing commas. I see that @soulomoon had a question about it too. Gild isn't (and hopefully won't be) configurable. I think trailing commas are generally preferable, especially when a final trailing comma is allowed (like it is in Cabal files for recent enough versions). It's a bit unfortunate in cases like this, but overall I think trailing commas are better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fan of this approach (non-configurability).
Similar approach is taken by elm-format, which became standard within elm community.
I like that most libraries you can get is formatted with it so there's very consistent feel to the whole ecosystem.
It eliminates a lot of pointless bickering on what format to choose.
One gets used to it pretty quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanx for the reasonning, I am convinced that it is good.
description: | ||
Backports for HIE files to GHC 8.8, along with a few other backports | ||
of HIE file related fixes for ghcide. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was deleted because blank lines in the description
field must be replaced by a lone period (foo\n.\nbar
). You can see on Hackage that the description is all one paragraph: https://hackage.haskell.org/package/hie-compat-0.3.1.2
If you don't want to do that, you could upgrade to cabal-version: 3.0
. You can see where Gild handles this here: https://github.com/tfausak/cabal-gild/blob/51425c05c67e6c335ba9024ced779669e3a4aca0/source/library/CabalGild/Unstable/Action/ReflowText.hs#L34
Here's the upstream Cabal PR for changing this behavior: haskell/cabal#5981
Compat.HieUtils | ||
|
||
if (impl(ghc >= 9.2) && impl(ghc < 9.3)) | ||
hs-source-dirs: src-ghc92 src-reexport-ghc9 | ||
if (impl(ghc >= 9.2)&& impl(ghc < 9.3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this formatting is no good. There should be a space before the &&
. I made an issue for this: tfausak/cabal-gild#72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed in version 1.3.1.3: https://github.com/tfausak/cabal-gild/releases/tag/1.3.1.3
defaults | ||
, warnings | ||
, pedantic | ||
-- plugins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tfausak here! This comment is (surprisingly?) preserved in situ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting with version 1.4.0.0, Gild will always float comments up to the top of fields.
dff31ba
to
ac4506d
Compare
ac4506d
to
7bda10f
Compare
Reformatted the |
Compare with #4230