Skip to content

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

Closed
@Bodigrim

Description

@Bodigrim
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.

Activity

georgefst

georgefst commented on Oct 27, 2023

@georgefst
Collaborator

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

Bodigrim

Bodigrim commented on Oct 27, 2023

@Bodigrim
ContributorAuthor

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

fendor

fendor commented on Oct 28, 2023

@fendor
Collaborator

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!

fendor

fendor commented on Aug 21, 2024

@fendor
Collaborator

Implemented by #4360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Bodigrim@fendor@georgefst

        Issue actions

          Use cabal-add to fill missing build-depends automatically · Issue #3853 · haskell/haskell-language-server