phoityne / haskell-dap

Haskell implementation of DAP interface data.
https://hackage.haskell.org/package/haskell-dap
BSD 3-Clause "New" or "Revised" License
24 stars 3 forks source link

phoityne vscode input #12

Open devxsss opened 4 years ago

devxsss commented 4 years ago

I have the following example code to debug

module Main where

import qualified Data.Map as M

errorsPerLine = M.fromList
    [ ("Chris", 472), ("Don", 100), ("Simon", -5) ]

main = do putStrLn "Who are you?"
          name <- getLine      
          case M.lookup name errorsPerLine of
              Nothing -> putStrLn "I don't know you"
              Just n  -> do putStr "Errors per line: "
                            print n

launch json settings

{ "type": "ghc", "request": "launch", "name": "haskell-debug-adapter", "internalConsoleOptions": "openOnSessionStart", "workspace": "${workspaceFolder}", "startup": "/homeokil.hs", "startupFunc": "main", "startupArgs": "olp", "stopOnEntry": true, "mainArgs": "okl", "ghciPrompt": "H>>= ", "ghciInitialPrompt": "Prelude>", "ghciCmd": "stack ghci --with-ghc=haskell-dap --test ", "ghciEnv": {}, "logFile": "${workspaceFolder}/.vscode/phoityne.log", "logLevel": "INFO", "forceInspect": false }

after I change startupArgs and mainargs to some string, the getline line in code stop but cannot get any arguments from the startupargs that i have set it in launch json, it keep waiting is there something wrong?

H>>= :load /home/devina/Documents/yogu/okil.hs [1 of 1] Compiling Main ( /home/devina/Documents/yogu/okil.hs, interpreted ) Ok, one module loaded. H>>= :dap-context-modules ... H>>= :dap-set-breakpoints ... H>>= [ERROR][APP] user error (loaded module can not find from path. </home/devina/Documents/okil.hs> [("Main","/home/devina/Documents/yogu/okil.hs")]) :dap-set-breakpoints ... No breakpoints found at that location. Breakpoint 0 activated at /home/devina/Documents/yogu/okil.hs:2:16-29 Breakpoint 1 activated at /home/devina/Documents/yogu/okil.hs:(4,8)-(9,19) Breakpoint 2 activated at /home/devina/Documents/yogu/okil.hs:5:3-40 Breakpoint 3 activated at /home/devina/Documents/yogu/okil.hs:6:3-23 H>>= :dap-set-breakpoints ... H>>= [ERROR][APP] user error (loaded module can not find from path. </home/devina/yogu/yogu.hs> [("Main","/home/devina/Documents/yogu/okil.hs")]) :dap-continue ...

:9:6: error: Variable not in scope: olp H>>= start debugging failed. user error (ExecResult not found.) : Left "user error (ExecResult not found.)" the startup args : olp result error ExecResult not found. how to fix this?
phoityne commented 4 years ago

Hi.

You can not use STDIN(getLine) handle while debugging. This is a limitation.

"startupArgs" is a setting for the command line argument. You can get it by "getArgs" function.

Regards.