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

Use cabal-add to fill missing build-depends automatically #3853

Open
Bodigrim opened this issue Oct 25, 2023 · 3 comments
Open

Use cabal-add to fill missing build-depends automatically #3853

Bodigrim opened this issue Oct 25, 2023 · 3 comments
Labels
component: hls-cabal-plugin Issues related to the hls-cabal-plugin type: enhancement New feature or request

Comments

@Bodigrim
Copy link
Contributor

When HLS gets an error "module Bla.Bla.Bla is a member of a hidden package bla" it should suggest a quick fix to insert the dependency on bla into Cabal file using https://github.com/Bodigrim/cabal-add and carry on.

cabal-add draft API can be examined here: https://hackage.haskell.org/package/cabal-add-0.1/candidate/docs/Distribution-Client-Add.html. My impression is that HLS should be very much capable to create Config and write the result of executeConfig to the disk.

CC @VeryMilkyJoe on behalf of hls-cabal-plugin.

@fendor fendor added component: hls-cabal-plugin Issues related to the hls-cabal-plugin and removed status: needs triage labels Oct 27, 2023
@georgefst
Copy link
Collaborator

This has been on the todo list for a long time: #155 (but maybe cabal-add is the solution!).

@Bodigrim
Copy link
Contributor Author

cabal-add preserves the formatting of the original file. I tested it on complete set of Cabal files from Hackage.

@fendor
Copy link
Collaborator

fendor commented Oct 28, 2023

Adding cabal-add should be a matter of parsing the error message, guessing the relevant .cabal file and then running cabal-add on it. #3778 can be used as an inspiration for this particular code action.
Nothing difficult about it, just someone needs to take the time to implement it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-cabal-plugin Issues related to the hls-cabal-plugin type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants