Open fendor opened 1 year ago
I guess this also very much relates to the error message issue. If the error message said "Can't load Setup.hs as there is no way to get the compilation options needed for a Setup.hs file, see
I came across exactly the same issue. Problems like this really turn people away and leave a very bad impression.
Problem
Setup.hs
is the build Script used by Cabal to actually build a cabal or stack package. It usually takes the trivial form ofwhere it can be omitted.
However, there exists a number of
Custom
Setup.hs
files that are far more complex, see for example thisSetup.hs
from cabal-testsuitePresently, it is impossible to load Setup.hs into HLS, neither the trivial
Setup.hs
nor the customSetup.hs
. Users are bombarded with intrusive and impossible to decipher error messages such as:and
Solution
To properly load
Setup.hs
, build tools, such as cabal and stack, need to be able to tell us what compilation options we need to buildSetup.hs
files.build-info
files. However, hie-bios makes no attempt to use these files.Setup.hs
from within Stack projects.We could also ignore any
Setup.hs
files using some heuristics, so that users are not greeted with the horrible error messages shown above:Workarounds
There exists one known workaround by exploiting the
cabal repl Scriptfile.hs
feature on recent cabal versions only. Requires acabal.project
file in the project.Example:
in combination with the following
hie.yaml
Ignoring the
Setup.hs
can be achieved with a customhie.yaml
file at the root of the project, such as:This is a meta-issue and should subsume all
Setup.hs
related issues.