Bench target needs manual build
almays opened this issue · comments
When I change cabal file, adding new dependencies, IDE is downloading and building new packages in the background. So when I do import
some module from freshly added dependency, I see no errors.
But in bench target, when I add criterion
or something to the dependencies of a benchmark, then no background build happens. And import
turns into error.
If I run stack bench
, then all needed packages get downloaded and built and then import stops being an error.
Is there any way to enable benchmarks as autoconstructed builds as well as tests, executables and lib?
The fact of the matter is that ghc-mod unconditionally runs stack build --only-dependencies
. Currently unreleased master
disables this by default, and once it is live, it would become possible to prompt user for a build (and also build relevant parts of the package).
As of right now, only workaround I can suggest is selecting 'auto' target in ide-haskell-cabal-v1.8.0, and run ide-haskell-cabal:build-dependencies
(or simply ide-haskell-cabal:build
) when a bench file is open.