Closed deflexor closed 8 years ago
You have to delete .stack-works/dist/x86_64-linux/Cabal-1.22.4.0/setup-config.ghc-mod.*
(or the equivalent).
I know, an option to do it automatically would be nice, sit tight for the next releases :)
@meditans can you provide some context for this ? what's the purpose of this file etc.. if you know of course
It's a bunch of caches that we generate from Cabal's LocalBuildInfo stuff.
See https://github.com/kazu-yamamoto/ghc-mod/blob/master/Language/Haskell/GhcMod/PathsAndFiles.hs#L228S
If you look for references to all those binders you'll find the places where the caches are being generated. Presumably they're not being invalidated properly.
I have a feeling this should have been fixed by a combination of https://github.com/kazu-yamamoto/ghc-mod/commit/8568a6785c8e87df7f021276fdb45d76d4df1e57 and https://github.com/kazu-yamamoto/ghc-mod/commit/a12a7fabc085c1cd66f7f1b30f0a328021ac751d. @deflexor can you try using master for a while to see if it happens again?
AFAIK the problem was that ghc-modi's in-memory cache was not being invalidated but rather written over the external cache files unconditionally. This lead to very strange behavior where ghc-mod debug
on the command line would show the problem and as soon as you clean the caches and do ghc-mod debug
again it would be fixed. But if you kept Emacs running in the mean time ghc-modi would just overwrite the external caches with it's wrong in-memory cache as soon as you run any command.
@deflexor Oh and don't forget to remove all the caches, we're using binary
instead of cereal
now so the format is different. Once we release the next version this will be fine as the caching code checks the ghc-mod version but for now it'll appear the same.
Just removing dist/
or .stack-work/
is the easiest way to accomplish that btw.
Checked it with github version of ghc-mod
and this behaviour is not repeating anymore. Thanks.
I am experiencing this issue with:
stack-1.0.0
ghc-mod-5.5.0.0
cabal-helper-0.6.3.1
Deleting files (running rm .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.*
on my project root) fixes the problem temporarily, but then these two files get created again:
.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.cabal-components
.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.resolved-components
I see the error for packages defined for test build, but in lib files. For example src/Foo.hs
would report that it Could not find module 'Test.Hspec'
. (I am of course not importing Hspec within Foo.)
Everything works when I run stack commands directly.
I had the same problem https://github.com/haskell/haskell-ide-engine/issues/1006
cleaning up worked for me:
rm -r .stack-work
stack test # I think I needed to run this before ghcmod could pick up the test targets
emacs
How to reproduce:
Create new project with
stack
tool, then open source file in emacs and add line like:import System.Random
Then open repl withC-c C-l
and it will offer to add packagerandom
to cabal file and restart ghci. After this done repl starts to work fine, but the import line in source buffer is still higlighted with red and if i run from terminalghc-mod check app/Main.hs
then get this error: