-
Notifications
You must be signed in to change notification settings - Fork 136
fix(cabal): cabal-fmt and cabal-gild discover module #384
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: main
Are you sure you want to change the base?
Conversation
`cabal-fmt` and `cabal-gild` can discover module and autocomplete. ```cabal -- cabal-gild: discover ./src exposed-modules: ``` The current system, treefmt can't detect change haskell module. I write to depend to haskell module file.
Maybe I mistake. |
To use manual script.
fe63af5
to
0dc9aa3
Compare
- Drop file filtering loops in cabal-fmt.nix and cabal-gild.nix - Use git ls-files -z | xargs to run formatter on all .cabal files - Avoid strict detection of cabal file args to simplify wrapper logic
0dc9aa3
to
5216610
Compare
I tested my product and cabal-gild. |
# For example, module completion by `cabal-fmt: discover`. | ||
# It is difficult to determine this strictly. | ||
# Since formatting with cabal-fmt doesn't take much time, we execute it speculatively. | ||
text = ''${pkgs.git}/bin/git ls-files -z "*.cabal"|${pkgs.parallel}/bin/parallel --null "${lib.getExe cfg.package} --inplace {}"''; |
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 not sure how many formatters we have that format other files besides the one we passed it. It looks like the formatter specification does allow this:
It SHOULD processes only the specified files. Files that are not passed SHOULD never be formatted.
Not your ptoblem, but I'm just realizing this might be an issue for the nascent Stdin Spec: numtide/treefmt#586
Actual problem: this assumes we're in a git repo, but we expect formatters to work in plain source archives as well.
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 not sure how many formatters we have that format other files besides the one we passed it. It looks like the formatter specification does allow this:
I miss to check of https://github.com/numtide/treefmt/blob/c24e1f1b4fc3087f4cbfef4a0ad076bd86b129f0/docs/site/reference/formatter-spec.md?plain=1#L46.
However, cabal need format cause other module change.
I think that should
not must
, I want to allow exception.
Is it no good?
I want to auto fix cabal module by claude code hook.
I have no idea smart solution.
Actual problem: this assumes we're in a git repo, but we expect formatters to work in plain source archives as well.
I think to depend git that ok because nix depend git already.
I use git ls-files
because I want to respect git ignore of real rule.
If prefer plain repo more than respect gitignore, I can use find
.
cabal-fmt
andcabal-gild
can discover module and autocomplete.The current system, treefmt can't detect change haskell module.
I write to depend to haskell module file.