phoityne / ghci-dap

ghci having DAP interface.
https://hackage.haskell.org/package/ghci-dap
Other
19 stars 3 forks source link

ghci-dap fails if stack's global resolver is newer than current project's #4

Open cloudcrypt opened 4 years ago

cloudcrypt commented 4 years ago

Scenario:

STACK_ROOT\global-project\stack.yaml contains resolver: lts-15.9

current_project_directory\stack.yaml contains resolver: lts-14.27

ghci-dap is installed by stack globally, installing ghci-dap.exe in the bin folder.

Issue: Occurs whenever --with-ghc=ghci-dap is used

[DAP][INFO] start ghci-dap-0.0.14.0.
GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help

<interactive>:1:1: error:
    Failed to load interface for `GHC.Base'
    There are files missing in the `base-4.12.0.0' package,
    try running 'ghc-pkg check'.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.

I tested this by creating a new stack project, using resolver: lts-15.9, and the issue did not occur.

(OS: Windows 10)

phoityne commented 4 years ago

haskell-debug-adapter does not switch exes dynamicaly. Could you install haskell-debug-adapter in the stack project folder ? It will switch global exe files to suitable version from snapshots.

 stack_project> stack install haskell-dap ghci-dap haskell-debug-adapter

Regards.

cloudcrypt commented 4 years ago

haskell-debug-adapter does not switch exes dynamicaly. Could you install haskell-debug-adapter in the stack project folder ? It will switch global exe files to suitable version from snapshots.

 stack_project> stack install haskell-dap ghci-dap haskell-debug-adapter

Regards.

This does work, it copies the suitable version from the snapshots into the global bin directory.

So is this the way then, that when switching between projects that use different resolvers, one has to run stack install haskell-dap ghci-dap haskell-debug-adapter in the current directory before debugging, every time one switches projects? And if so, any way this type of thing can be automatic, perhaps in the VSCode extension?

phoityne commented 4 years ago

Could you set full path to the ghci-dap with "--with-ghc" option in the launch.json ?

--with-ghc=C:\\Users\\phoityne\\AppData\\Roaming\\stack\\snapshots\\xxxxxxxx\\bin\\ghci-dap

You can use suitable ghci-dap for each project.

cloudcrypt commented 4 years ago

Yeah, that can certainly work. Might there be any way to make this more automatic though?