phoityne / hdx4vsc

Haskell Debugger Extension for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode
BSD 3-Clause "New" or "Revised" License
50 stars 9 forks source link

Cabal + VSCode + debugging problem #32

Open fr0ster opened 1 year ago

fr0ster commented 1 year ago

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.

phoityne commented 1 year ago

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.

fr0ster commented 1 year ago

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

new-user-name commented 1 year ago
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

new-user-name commented 1 year ago

https://github.com/haskell/cabal/issues/8379 it seems to be Cabal issue

build-type: Simple doesn't help

simonmichael commented 1 year ago

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

simonmichael commented 1 year ago

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

luk-rs commented 1 year ago

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.

simonmichael commented 1 year ago

@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
    }
  ]
}
luk-rs commented 1 year ago

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.

simonmichael commented 1 year ago

I don't seem to have any mention of ghci-dap in the cabal file; you can see the same or similar file at https://hub.darcs.net/simon/darcs-screened/browse/darcs.cabal . I was also testing on a mac. Sorry, I don't remember what version of ghc and cabal I was using at the time.D

luk-rs commented 1 year ago

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