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

Features

  • The source file extension must be ".hs"
  • Can not use STDIN handle while debugging.
  • Creating tasks.json.
  • Shortcut keys
    • F5 : start / continue debugging
    • F6 : show command menu
    • Shift + F6 : stop watch
    • F7 : clean & build
    • F8 : start test
    • F9 : put a breakpoint on the current line
    • Shift + F9 : put a breakpoint on the current column
    • F10 : step next
    • F11 : step into

Install

Stack

Install haskell-dap, ghci-dap, haskell-debug-adapter at once.

$ stack update
$
$ stack install haskell-dap ghci-dap haskell-debug-adapter
$
$ ghci-dap --version
[DAP][INFO] start ghci-dap-0.0.XX.0.
The Glorious Glasgow Haskell Compilation System, version X.X.X
$
$ haskell-debug-adapter --version
VERSION: haskell-debug-adapter-0.0.XX.0
$

Cabal

Install ghci-dap, haskell-debug-adapter.

$ cabal update
$
$ cabal install ghci-dap haskell-debug-adapter
$
$ haskell-debug-adapter --version
VERSION: haskell-debug-adapter-0.0.XX.0
$

Run

1. Create a project

Stack project

$ mkdir project_stack
$ cd project_stack
$
$ stack new sample --bare
$ stack test
$

Cabal project

$ mkdir project_cabal
$ cd project_cabal
$
$ cabal init
$ cabal configure
$ cabal bulid
$

2. VSCode debug setting

01_create_launch.png 02_create_launch.png

3. Select a debug configuration

Stack project

03_select_stack.png

Cabal project

03_select_cabal.png

4. Put a breakpoint

04_bp.png

5. Start debugging

05_run.png 06_break.png

Configuration

see sample files.

.vscode/launch.json

NAME REQUIRED OR OPTIONAL DEFAULT SETTING DESCRIPTION
startup required ${workspaceRoot}/test/Spec.hs debug startup file, will be loaded automatically.
startupFunc optional "" (empty string) debug startup function, will be run instead of main function.
startupArgs optional "" (empty string) arguments for startup function. set as string type.
stopOnEntry required false stop or not after debugger launched.
mainArgs optional "" (empty string) main arguments.
ghciPrompt required H>>= ghci command prompt string.
ghciInitialPrompt optional "Prelude> " initial pormpt of ghci. set it when using custom prompt. e.g. set in .ghci
ghciCmd required cabal repl -w ghci-dap --repl-no-load --builddir=${workspaceFolder/.vscode/dist-cabal-repl launch ghci command.
ghciEnv required {} Environment variables for ghci exectution.
logFile required ${workspaceRoot}/.vscode/phoityne.log internal log file.
logLevel required WARNING internal log level.
forceInspect required false Inspect scope variables force.

About

Haskell Debugger Extension for Visual Studio Code.

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

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:TypeScript 92.2%Language:Batchfile 4.3%Language:Shell 3.5%