diff --git a/plugins/hls-tactics-plugin/README.md b/plugins/hls-tactics-plugin/README.md index 83381f26ec..c5bff73768 100644 --- a/plugins/hls-tactics-plugin/README.md +++ b/plugins/hls-tactics-plugin/README.md @@ -34,6 +34,78 @@ fill hole" code action, *et voila!* [hls]: https://github.com/haskell/haskell-language-server/releases +## Editor Configuration + +### Enabling Jump to Hole + +Set the `haskell.plugin.tactics.config.hole_severity` config option to `4`, or +`hint` if your editor uses a GUI for its configuration. This has the potential +to negatively impact performance --- please holler if you notice any appreciable +slowdown by enabling this option. + + +### coc.nvim + +The following vimscript maps Wingman code-actions to your leader key: + +```viml +" use [h and ]h to navigate between holes +nnoremap [h :call CocActionAsync('diagnosticPrevious', 'hint') +nnoremap ]h :call JumpToNextHole() + +" d to perform a pattern match, n to fill a hole +nnoremap d :set operatorfunc=WingmanDestructg@l +nnoremap n :set operatorfunc=WingmanFillHoleg@l + +" beta only +nnoremap r :set operatorfunc=WingmanRefineg@l +nnoremap c :set operatorfunc=WingmanUseCtorg@l +nnoremap a :set operatorfunc=WingmanDestructAllg@l + + +function! s:JumpToNextHole() + call CocActionAsync('diagnosticNext', 'hint') +endfunction + +function! s:GotoNextHole() + " wait for the hole diagnostics to reload + sleep 500m + " and then jump to the next hole + normal 0 + call JumpToNextHole() +endfunction + +function! s:WingmanRefine(type) + call CocAction('codeAction', a:type, ['refactor.wingman.refine']) + call GotoNextHole() +endfunction + +function! s:WingmanDestruct(type) + call CocAction('codeAction', a:type, ['refactor.wingman.caseSplit']) + call GotoNextHole() +endfunction + +function! s:WingmanDestructAll(type) + call CocAction('codeAction', a:type, ['refactor.wingman.splitFuncArgs']) + call GotoNextHole() +endfunction + +function! s:WingmanFillHole(type) + call CocAction('codeAction', a:type, ['refactor.wingman.fillHole']) + call GotoNextHole() +endfunction + +function! s:WingmanUseCtor(type) + call CocAction('codeAction', a:type, ['refactor.wingman.useConstructor']) + call GotoNextHole() +endfunction +``` + +### Other Editors + +Please open a PR if you have a working configuration! + + ## Features * [Type-directed code synthesis][auto], including pattern matching and recursion