Phoityne VSCode
Phoityne is a ghci debug viewer for Visual Studio Code.
- [2017/08/16] phoityne-vscode released.
- Release Summary
- [ADD] supported break-on-exception and break-on-error.
- [ADD] 5 : adding ghci run enviroment variable setting.
Check!! that there is a ""ghciEnv": {}," setting in the launch.json.
- [MODIFY] 21 : support evaluateName attribute for watch variable.
(This sample project is available from here.)
Important
- LIMITATION: Breakpoint can be set in a .hs file which defineds "module ... where".
- LIMITATION: Source file extension must be ".hs"
- LIMITATION: Can not use STDIN handle while debugging.
- LIMITATION: Changing ghci prompt is not allowed in the .ghci file.
- When you start debugging for the first time, .vscode/tasks.json will be created automatically. Then you can use F6, F7, F8 shortcut key.
- F5 : start debug
- F6 : show command menu (for stack watch)
- Shift + F6 : stop stack watch
- F7 : stack clean & build
- F8 : stack test
- F9 : put bp on current line
- Shift + F9 : put bp on current column
- While debugging, you can use F5, F9, F10, F11 shortcut key.
- F5 : jump to next bp
- F9 : put bp on the line
- Shift + F9 : put bp on the column
- F10 : step next
- F11 : step into
Install
Run stack install
% stack install phoityne-vscode
. . . . .
%
Add 'phoityne-vscode.exe' to PATH environment.
% where $path:phoityne-vscode.exe
C:\Users\[user name]\AppData\Roaming\local\bin\phoityne-vscode.exe
% phoityne-vscode --version
phoityne-vscode-0.0.15.0
%
% code
Install vscode extensions
- run VSCode and open stack project Folder from file menu.
- open Extensions from side menu of VSCode.
- search "haskell"
- select "Haskell GHCi debug viewer Phoityne"
Features
Run to Cursor
Bindings & Watch
The variable added to watch will be forced.
Stack trace
Break condition
Hit count break condition
Supports these operators.
- ==
- /=
- <, >
- <=, >=
- mod, %
- just digit is same with '>='
Break on Exception
Repl & Completions
Capabilites
- supportsConfigurationDoneRequest : yes
- supportsFunctionBreakpoints : yes
- supportsConditionalBreakpoints : yes
- supportsHitConditionalBreakpoints : yes
- supportsEvaluateForHovers : yes
- exceptionBreakpointFilters : yes
- supportsStepBack : no
- supportsSetVariable : no
- supportsRestartFrame : no
- supportsGotoTargetsRequest : no
- supportsStepInTargetsRequest : no
- supportsCompletionsRequest : yes
- supportsModulesRequest : no
- additionalModuleColumns : no
- supportedChecksumAlgorithms : no
- supportsRestartRequest : no
- supportsExceptionOptions : no
- supportsValueFormattingOptions : no
- supportsExceptionInfoRequest : no
- supportTerminateDebuggee : no
- supportsDelayedStackTraceLoading : no
Configuration
.vscode/launch.json
NAME |
REQUIRED OR OPTIONAL |
DEFAULT SETTING |
DESCRIPTION |
startup |
required |
${workspaceRoot}/test/Spec.hs |
debug startup file, will be loaded automatically. |
ghciCmd |
required |
stack ghci --test --no-load --no-build --main-is TARGET --ghci-options -fprint-evld-with-show |
launch ghci command, must be Prelude module loaded. For example, "ghci -i\({workspaceRoot}/src", "cabal exec -- ghci -i\){workspaceRoot}/src" |
ghciPrompt |
required |
H>>= |
ghci command prompt string. |
stopOnEntry |
required |
true |
stop or not after debugger launched. |
logFile |
required |
${workspaceRoot}/.vscode/phoityne.log |
internal log file. |
logLevel |
required |
WARNING |
internal log level. |
mainArgs |
optional |
- |
main arguments. |
.vscode/tasks.json
TASK NAME |
REQUIRED OR OPTIONAL |
DEFAULT SETTING |
DESCRIPTION |
stack build |
required |
stack build |
task definition for F6 shortcut key. |
stack clean & build |
required |
stack clean && stack build |
task definition for F7 shortcut key. |
stack test |
required |
stack test |
task definition for F8 shortcut key. |
stack watch |
required |
stack build --test --no-run-tests --file-watch |
task definition for F6 shortcut key. |