phoityne / hdx4vsc

Haskell Debugger Extension for Visual Studio Code.

Home Page:https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cabal + VSCode + debugging problem

fr0ster opened this issue · comments

I installed plugin from VSCode, created haskell project by cabal and add config for debuging in launch.json
I got parameter "ghciCmd": "cabal repl -w ghci-dap --repl-no-load --builddir=${workspaceFolder}/.vscode/dist-cabal-repl" but in repositories exist another value this parameters - "cabal exec -- ghci-dap --interactive -i -i${workspaceFolder}"

With this default parameters debugging doesn't work at all.
In README.md any word about new value for this parameters

For stack project all works from box.

Hi.
Is there any messages on the vscode console ?
when running by this parameter.

 "ghciCmd": "cabal repl -w ghci-dap --repl-no-load --builddir=${workspaceFolder}/.vscode/dist-cabal-repl"

Regards.

Sorry for later answer
Respond is:
cabal: unrecognized 'repl' option --repl-no-load'`

CMD: cabal repl -w ghci-dap --repl-no-load --builddir=/home/hippo/.vscode/dist-cabal-repl
Now, waiting for an initial prompt("> ") from ghci.
cabal: unrecognized 'repl' option `--repl-no-load'
2
invalid HANDLE. eof.

I have the same problem

haskell/cabal#8379
it seems to be Cabal issue

build-type: Simple
doesn't help

Same. I removed --repl-no-load from the command in launch.json, and it went further. (With darcs codebase, it fails like this):
(SNIP)

Ah! Adjusted main module path in launch.json, and I see it working now.

Ah! Adjusted main module path in launch.json, and I see it working now.

Hey Simon can you give further insight on how you overcame this? What specific changes have you made? I'm having a similar issue without even having any logs/output of what's happening.

@luk-rs here's my .vscode/launch.json:

  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "ghc",
      "request": "launch",
      "name": "haskell(stack)",
      "internalConsoleOptions": "openOnSessionStart",
      "workspace": "${workspaceFolder}",
      "startup": "${workspaceFolder}/test/Spec.hs",
      "startupFunc": "",
      "startupArgs": "",
      "stopOnEntry": false,
      "mainArgs": "",
      "ghciPrompt": "H>>= ",
      "ghciInitialPrompt": "> ",
      "ghciCmd": "stack ghci --with-ghc=ghci-dap --test --no-load --no-build --main-is TARGET",
      "ghciEnv": {},
      "logFile": "${workspaceFolder}/.vscode/phoityne.log",
      "logLevel": "WARNING",
      "forceInspect": false
    },
    {
      "type": "ghc",
      "request": "launch",
      "name": "haskell(cabal)",
      "internalConsoleOptions": "openOnSessionStart",
      "workspace": "${workspaceFolder}",
      "startup": "${workspaceFolder}/darcs/darcs.hs",
      "startupFunc": "",
      "startupArgs": "",
      "stopOnEntry": false,
      "mainArgs": "show dependencies --repodir a",
      "ghciPrompt": "H>>= ",
      "ghciInitialPrompt": "> ",
      "ghciCmd": "cabal repl -w ghci-dap --builddir=${workspaceFolder}/.vscode/dist-cabal-repl",
      "ghciEnv": {},
      "logFile": "${workspaceFolder}/.vscode/phoityne.log",
      "logLevel": "WARNING",
      "forceInspect": false
    }
  ]
}

Thanks a lot @simonmichael. Can you just clarify me a few other details? Ghc version and cabal version and also whether you need to reference ghci-dap on your cabal file. Because my vs code isn't even providing me any logs when trying to run via this configuration. Also I'm running on a mac don't know if that can influence the outcome in any way.

Thanks for your help @simonmichael it turns out that besides ghci-dap and haskell-dap you should also install haskell-debug-adapter to be able to attach to vscode, I hope this info helps other people struggling with this issue