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 library support for adding modules to components #8

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

VeryMilkyJoe
Copy link

@VeryMilkyJoe VeryMilkyJoe commented Oct 13, 2024

Added a target field to the config, which defines the field of the component to add the given values to.
The algorithms now adds values to the target field instead of always adding to build-depends.

The executeConfig function can now be configured to add to different fields while the cli tool will still always use execute config for build-depends.
This would be very useful for HLS, as we want to use cabal-add as a library to be able to offer code actions to add unknown modules to cabal files in a project.

Added some tests, verifying that modules can be added correctly with the right config.
If the previously written modules are separated by a space, instead of a comma, we currently don't extend accordingly, this is reflected in a test which currently fails.

Added a target field to config, which defines the field to add the given values to.
@Bodigrim
Copy link
Owner

Sorry, I'm short on time at the moment. I skimmed through, seems fine overall, thanks! I'll review again once you get CI green.

@VeryMilkyJoe
Copy link
Author

Great, thank you!

Copy link
Owner

@Bodigrim Bodigrim left a comment

Choose a reason for hiding this comment

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

Thanks for lots of tests! Few nipticks, but overall looks good!

app/Main.hs Outdated Show resolved Hide resolved
cabal-add.cabal Show resolved Hide resolved
src/Distribution/Client/Add.hs Outdated Show resolved Hide resolved
src/Distribution/Client/Add.hs Show resolved Hide resolved
src/Distribution/Client/Add.hs Outdated Show resolved Hide resolved
src/Distribution/Client/Add.hs Outdated Show resolved Hide resolved
src/Distribution/Client/Add.hs Outdated Show resolved Hide resolved
src/Distribution/Client/Add.hs Outdated Show resolved Hide resolved
src/Distribution/Client/Add.hs Outdated Show resolved Hide resolved
@VeryMilkyJoe
Copy link
Author

Thanks for lots of tests! Few nipticks, but overall looks good!

I made all the changes you requested and also took care of the warnings in the new test-suite, thank you for the quick review!

…xisting modules in target field are separated by spaces instead of commas

Add tests which verify correct behaviour
@Bodigrim Bodigrim merged commit dd8b567 into Bodigrim:master Oct 22, 2024
6 checks passed
@Bodigrim
Copy link
Owner

Thanks a ton!

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.

2 participants