Summary
When Multiple Component Support enabled, HLS won't update the state even when any *.cabal file update.
Your environment
Which OS do you use? macOS
Which version of GHC do you use and how did you install it? GHC 9.4.8
How is your project built (alternative: link to the project)? Cabal 3.11.0.0 prerelease (installed by ghcup --no-cache install cabal -u 'https://gitlab.haskell.org/haskell/cabal/-/jobs/1848320/artifacts/raw/out/cabal-install-3.11.0.0-x86_64-linux-alpine3_12.tar.xz' 3.12.0.0-prerelease )
Which LSP client (editor/plugin) do you use? VSCode
Which version of HLS do you use and how did you install it? HLS 2.8.0.0, installed via ghcup
Have you configured HLS in any way (especially: a hie.yaml file)? No hie.yaml
Steps to reproduce
-
Install cabal 3.12.0.0 prerelease. For example:
ghcup --no-cache install cabal -u 'https://gitlab.haskell.org/haskell/cabal/-/jobs/1848320/artifacts/raw/out/cabal-install-3.11.0.0-x86_64-linux-alpine3_12.tar.xz' 3.12.0.0-prerelease --no-set
-
Clone konn/hls-cabal-monorepo-multihome-recomp-repro
git clone https://github.com/konn/hls-cabal-monorepo-multihome-recomp-repro.git
-
Make sure LSP client uses HLS 2.8 and Cabal 3.11.0.0. You don't have to any configuration if you are using VSCode, as it contains the necessary configuration file.
-
Open package-a/src/MyLibA.hs and package-b/src/MyLibB.hs and wait for HLS to warmup.
-
After HLS has been successfully launched, add package-a as the build-depends of package-b, remove someFunc from MyLibB.hs and import MyLibA instead.
diff --git a/package-b/package-b.cabal b/package-b/package-b.cabal
index e74338b..b23761d 100644
--- a/package-b/package-b.cabal
+++ b/package-b/package-b.cabal
@@ -13,5 +13,8 @@ extra-doc-files: CHANGELOG.md
library
ghc-options: -Wall
exposed-modules: MyLibB
- build-depends: base
+ build-depends:
+ base,
+ package-a,
+
hs-source-dirs: src
diff --git a/package-b/src/MyLibB.hs b/package-b/src/MyLibB.hs
index febc71a..936e822 100644
--- a/package-b/src/MyLibB.hs
+++ b/package-b/src/MyLibB.hs
@@ -1,4 +1,3 @@
module MyLibB (someFunc) where
-someFunc :: IO ()
-someFunc = putStrLn "someFunc"
+import MyLibA
Expected behaviour
HLS should reconfigure package-b so that MyLibA can be imported in MyLibB without any hassle.
Actual behaviour
HLS seems to make no recompilation/state update, and complaining MyLibA not found.
Could not find module ‘MyLibA’
It is not a module in the current program, or in any known package
Side note
- In this case, we added a local package. The same bug occurs if one adds some other (boot or external) packages.
- If one changes
sessionLoading to singleComponent, then HLS updates/recompiles when *.cabal changes.
Debug information
lop.log
Summary
When Multiple Component Support enabled, HLS won't update the state even when any
*.cabalfile update.Your environment
Which OS do you use? macOS
Which version of GHC do you use and how did you install it? GHC 9.4.8
How is your project built (alternative: link to the project)? Cabal 3.11.0.0 prerelease (installed by
ghcup --no-cache install cabal -u 'https://gitlab.haskell.org/haskell/cabal/-/jobs/1848320/artifacts/raw/out/cabal-install-3.11.0.0-x86_64-linux-alpine3_12.tar.xz' 3.12.0.0-prerelease)Which LSP client (editor/plugin) do you use? VSCode
Which version of HLS do you use and how did you install it? HLS 2.8.0.0, installed via ghcup
Have you configured HLS in any way (especially: a
hie.yamlfile)? Nohie.yamlSteps to reproduce
Install cabal 3.12.0.0 prerelease. For example:
ghcup --no-cache install cabal -u 'https://gitlab.haskell.org/haskell/cabal/-/jobs/1848320/artifacts/raw/out/cabal-install-3.11.0.0-x86_64-linux-alpine3_12.tar.xz' 3.12.0.0-prerelease --no-setClone
konn/hls-cabal-monorepo-multihome-recomp-reproMake sure LSP client uses HLS 2.8 and Cabal 3.11.0.0. You don't have to any configuration if you are using VSCode, as it contains the necessary configuration file.
Open
package-a/src/MyLibA.hsandpackage-b/src/MyLibB.hsand wait for HLS to warmup.After HLS has been successfully launched, add
package-aas thebuild-dependsofpackage-b, removesomeFuncfromMyLibB.hsand importMyLibAinstead.Expected behaviour
HLS should reconfigure package-b so that
MyLibAcan be imported inMyLibBwithout any hassle.Actual behaviour
HLS seems to make no recompilation/state update, and complaining
MyLibAnot found.Side note
sessionLoadingtosingleComponent, then HLS updates/recompiles when*.cabalchanges.Debug information
lop.log