hdevtools icon indicating copy to clipboard operation
hdevtools copied to clipboard

Type information only works the first time in Stack projects

Open lunaris opened this issue 10 years ago • 0 comments

When trying to extract type information for an identifier using (e.g.):

% hdevtools type src/Main.hs 1 1

Where src/Main.hs is part of a Stack project, the command succeeds the first time but not on subsequent iterations, failing with messages like:

Cabal error: At least the following dependencies are missing:
    either -any,
    ...

After doing some investigation, I believe this is due to the second invocation attempting to find stack.yaml-related configuration whilst being in a different working directory. I think this is due to https://github.com/schell/hdevtools/blob/master/src/CommandLoop.hs#L142, which performs:

liftIO $ setCurrentDirectory . takeDirectory $ cabalConfigPath cabalConfig

Commenting out this line indeed fixes my issue, but I imagine it has implications for loading Cabal configuration here or elsewhere? Can someone more knowledgeable confirm/deny? I'm happy to finish the job and turn my fix into a complete PR if so.

lunaris avatar Sep 15 '15 09:09 lunaris