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

Add some of the other cabal-fmt refactorings? #94

Open
michaelpj opened this issue Jul 1, 2024 · 7 comments
Open

Add some of the other cabal-fmt refactorings? #94

michaelpj opened this issue Jul 1, 2024 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@michaelpj
Copy link

cabal-fmt has, as far as I know, two additional undocumented "refactorings" beyond expanding modules:

  1. Inserting "fragments", useful for sharing things between cabal files, e.g. https://github.com/phadej/cabal-fmt/blob/master/fixtures/fragment-section.cabal
  2. Expanding file globs in some fields, e.g. https://github.com/phadej/cabal-fmt/blob/master/fixtures/simple-example.cabal#L43

I think both of these are quite nice features, it would be cool if cabal-gild had something similar.

@tfausak tfausak added the enhancement New feature or request label Jul 1, 2024
@tfausak
Copy link
Owner

tfausak commented Jul 1, 2024

cabal-fmt's glob-files pragma should be supported by Gild's discover pragma since #86. It uses the same syntax as the module discovery pragma but it discovers files instead of modules.

I would like to add support for importing fragments.

@tfausak
Copy link
Owner

tfausak commented Jul 1, 2024

@michaelpj
Copy link
Author

Yeah, I guess the fragments is the main one. This came up because we're thinking of using cabal-fmt's fragments, and I would otherwise suggest using cabal-gild :)

@tfausak tfausak added the help wanted Extra attention is needed label Jul 19, 2024
@tfausak
Copy link
Owner

tfausak commented Jul 19, 2024

I've tagged this as "help wanted". It would be nice for Gild to support importing fragments. I doubt I'll have the time to add that feature myself.

@BebeSparkelSparkel
Copy link

@michaelpj @michaelpj Have you worked on this at all? If so, could you share your changes in a draft pr?

@michaelpj
Copy link
Author

I have not looked at this.

@tfausak
Copy link
Owner

tfausak commented Jul 26, 2024

No, I have not yet looked at this. I doubt I will anytime soon.

My only thought about the implementation is that fragments importing other fragments is perhaps desirable but also could get stuck in a loop. Perhaps there should be a configurable maximum depth that defaults to something reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants