-
-
Notifications
You must be signed in to change notification settings - Fork 396
Format .cabal files with cabal-gild #4229
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
base: master
Are you sure you want to change the base?
Conversation
b3b4bd4
to
dff31ba
Compare
hls-test-utils/hls-test-utils.cabal
Outdated
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!
, 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.
ac4506d
to
7bda10f
Compare
Reformatted the |
5eb7a78
to
cefc2d9
Compare
@VeryMilkyJoe Thanks for rebasing this, I think we should merge this PR now and see how annoying it is for future contributors. Formatted with cabal-gild-1.5.0.1 |
Shipit! |
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.
bug-reports: https://github.com/haskell/haskell-language-server/issues | ||
tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7} | ||
bug-reports: https://github.com/haskell/haskell-language-server/issues | ||
tested-with: ghc ==9.12.2 || ==9.10.1 || ==9.8.4 || ==9.6.7 |
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.5.0.3, Gild will correctly leave this in set notation. See tfausak/cabal-gild#118.
Chart, | ||
Chart-diagrams, | ||
aeson, | ||
base >=4 && <5, |
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.
Same note here: Starting with version 1.5.0.3, Gild will correctly retain the wildcard version constraint. tfausak/cabal-gild#118
hls-plugin-api ==2.11.0.0, | ||
hls-test-utils ==2.11.0.0, | ||
|
||
if flag(isolatecabalfmttests) |
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.
Cabal converts flag names to lowercase. Gild does the same in order to make this conversion obvious. However it could retain the case from the input if desired. See #4230 (comment).
haskell-language-server:hls-cabal-fmt-plugin, | ||
haskell-language-server:hls-cabal-plugin, |
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.
Just so you know, these can use set notation:
haskell-language-server:hls-cabal-fmt-plugin, | |
haskell-language-server:hls-cabal-plugin, | |
haskell-language-server:{hls-cabal-fmt-plugin, hls-cabal-plugin}, |
if os(darwin) | ||
ghc-options: -optl-Wl,-ld_classic | ||
if os(osx) | ||
ghc-options: "-optl-Wl,-ld_classic" |
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, I wonder why this got quoted. Maybe because there's a comma in it?
Also note that darwin
and osx
are aliases. Gild canonicalizes operating systems (and architectures).
, time | ||
|
||
hs-source-dirs: plugins/hls-refactor-plugin/src | ||
build-depends: | ||
-- FIXME: Only needed to workaround for qualified imports in GHC 9.4 |
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 comment got floated up to the top of the build-depends
, so it doesn't really make sense anymore. I would suggest something like this:
build-depends:
bytestring,
...
-- FIXME: Only needed to workaround for qualified imports in GHC 9.4
build-depends:
parser-combinators,
regex-applicative
, semanticTokens | ||
, notes | ||
import: | ||
-- 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.
Same note here about comment placement.
directory, | ||
extra, | ||
filepath, | ||
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.
In this case I don't think it changes the semantics, but starting with version 1.5.0.3, Gild would keep this as ghcide:{ghcide}
. See tfausak/cabal-gild#115.
cefc2d9
to
2c69e4c
Compare
Compare with #4230
Closes #4228