CrystalSplitter / ghcitui

A Terminal User Interface for the Glasgow Haskell Compiler Interactive Mode
BSD 3-Clause "New" or "Revised" License
57 stars 1 forks source link

Stack project support #30

Open BebeSparkelSparkel opened 9 months ago

BebeSparkelSparkel commented 9 months ago

Looking at the MANUAL.rst it seems that only cabal repl is supported. It would be nice to also support stack repl as well.

Perhaps this is already supported with the --cmd option, but this is unclear and may just be for adding more cabal aguments.

BebeSparkelSparkel commented 9 months ago

This is not a bug but a feature request.

CrystalSplitter commented 9 months ago

--cmd does handle this actually. However, I basically just don't use stack ever. If you have some guidance on what the "correct" stack invocation is, I could add a flag for it for "easy access".

simonmichael commented 2 weeks ago

+1! ghcitui is potentially very impactful and needs more users and testers.

In your project, whether you use cabal or stack, find a command that gets you a useful GHCI prompt, then just run ghcitui --cmd 'CMD'. It's similar to ghcid in this way.

In simple stack projects that might be just

ghcitui --cmd 'stack ghci'

In my multi-package project, it's ghcitui --cmd 'just ghci', which in essence is (loading multiple packages at once):

ghcitui --cmd 'stack exec -- ghci -ihledger-lib -ihledger hledger/Hledger/Cli.hs'

Some ways of starting GHCI don't seem to work so well with ghcitui. You should see a list of modules in the lower right Modules pane, and when you press M to focus there, select a module with up/down, and press enter to view it, you should see its source in the main pane. If so, it's good, and setting breakpoints, starting with :main, stepping with s etc. should work.

CrystalSplitter commented 2 weeks ago

To clarify with:

Some ways of starting GHCI don't seem to work so well with ghcitui. You should see a list of modules in the lower right Modules pane, and when you press M to focus there, select a module with up/down, and press enter to view it, you should see its source in the main pane. If so, it's good, and setting breakpoints, starting with :main, stepping with s etc. should work.

Was this the bit that's related to #48? Just want to be sure this isn't part of the feature request for stack support, but rather part of a bug report about module's not displaying their source in the source viewer window.

simonmichael commented 2 weeks ago

Hi @CrystalSplitter, yes I feel that's related to #48 as the symptom was the same, even though in this case there was multiple modules: selecting a module didn't show code in the main pane. I mentioned it on #30 as finding stack/cabal repl commands that avoid that seemed important. (I don't have an exact repro for you.)

CrystalSplitter commented 2 weeks ago

Hmm. That's interesting. If you do find a reproducer with multiple modules, do let me know!

I'll put this one on the backburner while I work on adding better multithread support.

CrystalSplitter commented 1 week ago

https://github.com/CrystalSplitter/ghcitui/pull/59 address the bit about how MANUAL.rst doesn't talk about how to use --cmd. Clarification I think there was overdue.

As for "intelligent" stack support, some ideas:

  1. I could just have it run stack repl. This works but it doesn't have any modules it seems by default. How does module detection work with stack? I can't seem to get it to find my modules by default, and the docs seem sparse on this.
  2. Is cabal by default a bad idea? It seems most projects use cabal, and stack projects are cabal-compatible, so it's never been an issue for me personally (ghcitui was created so I could debug the fourmolu project). But I would be interested to know your use cases.