atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Can't get type in test files #231

Closed BillyBadBoy closed 6 years ago

BillyBadBoy commented 6 years ago

I'm not sure if this is a bug or just a problem with my setup, but I cannot get atom to display type info inside my test files.

I have a stack project with the default directory structure. The types display OK in all my source files but not in my test file (which lives under the test folder). I get the message:

haskell-ghc-mod
Error: No Info

Any idea what the problem is ?

BillyBadBoy commented 6 years ago

I can fix the problem by adding a module declaration at the top of my spec.hs file. The initial version created by stack just includes a main function.

Is this expected behaviour for haskell-ghc-mod ?

lierdakil commented 6 years ago

So, one caveat with stack: it doesn't enable tests by default. So you need to build your tests (once) for ghc-mod to work with them. Another caveat: stack will remove tests when you rebuild not-tests.

If you're using ide-haskell-cabal, one way around that is to specifically choose your test-suite as a build target, then stack will build everything including tests.

If you leave it at 'All: Auto', ide-haskell-cabal builds only the target to which currently open file belongs, so if you run build with test sources open, it will build tests and all will be good (well, until you close tests, change library or executable, rebuild those, and then come back to tests)

BillyBadBoy commented 6 years ago

Thanks for the clarification.