haskell-mode
haskell-mode copied to clipboard
[WIP] Use single session per stack project
I have a stack project with a few local packages that I work on together. I found that haskell-mode would create a stack ghci process/buffer for each project, and each one would load all the projects, as stack ghci does.
This change defaults each module under the stack project to the same ghci instance.
What do you think? I haven't had any problems with it, and it saves a ton of memory for ghci processes, as well as simplifying work on multiple packages.
WIP because the buffer name is inconsistent with cabal, but using the package name on its own seems kind of fragile too... Maybe it should be the full path to the stack.yaml / .cabal with some sort of prefix?
TODO: share the file logic with (haskell-process-type)
TODO: The directory for the ghci buffer ends up being set to the project where it is first created. It doesn't seem to matter to stack ghci, but having it run in the root of the stack project would be cleaner.
Looks good to me. Ping us when you finish.
It's working for my purposes, but it may be complicated by certain things assuming there is a cabal-dir per session (e.g. tag generation). I'll dig into it a bit more, but it's not as close to complete as I hoped.
I'll let you know.
See also #1547.
I support the idea behind this idea, would be great.