Skip to content

Commit d6de2bb

Browse files
stuebinmjneira
andauthored
Wingman: add emacs example config to Readme (#1988)
This adds a barebones example config for emacs. Most things work out of the box anyways, but I found the `lsp-make-interactive-code-action` function somewhat hard to find, so I think the pointer to it would probably benefit people. Co-authored-by: Javier Neira <[email protected]>
1 parent 2df3d30 commit d6de2bb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

plugins/hls-tactics-plugin/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,33 @@ function! s:WingmanUseCtor(type)
9999
endfunction
100100
```
101101

102+
### Emacs
103+
104+
When using Emacs, wingman actions should be available out-of-the-box and
105+
show up e.g. when using `M-x helm-lsp-code-actions RET` provided by
106+
[helm-lsp](https://github.com/emacs-lsp/helm-lsp) or as popups via
107+
[lsp-ui-sideline](https://emacs-lsp.github.io/lsp-ui/#lsp-ui-sideline).
108+
109+
Additionally, if you want to bind wingman actions directly to specific
110+
keybindings or use them from Emacs Lisp, you can do so like this:
111+
112+
``` emacs-lisp
113+
;; will define elisp functions for the given lsp code actions, prefixing the
114+
;; given function names with "lsp"
115+
(lsp-make-interactive-code-action wingman-fill-hole "refactor.wingman.fillHole")
116+
(lsp-make-interactive-code-action wingman-case-split "refactor.wingman.caseSplit")
117+
(lsp-make-interactive-code-action wingman-refine "refactor.wingman.refine")
118+
(lsp-make-interactive-code-action wingman-split-func-args "refactor.wingman.spltFuncArgs")
119+
(lsp-make-interactive-code-action wingman-use-constructor "refactor.wingman.useConstructor")
120+
121+
;; example key bindings
122+
(define-key haskell-mode-map (kbd "C-c d") #'lsp-wingman-case-split)
123+
(define-key haskell-mode-map (kbd "C-c n") #'lsp-wingman-fill-hole)
124+
(define-key haskell-mode-map (kbd "C-c r") #'lsp-wingman-refine)
125+
(define-key haskell-mode-map (kbd "C-c c") #'lsp-wingman-use-constructor)
126+
(define-key haskell-mode-map (kbd "C-c a") #'lsp-wingman-split-func-args)
127+
```
128+
102129
### Other Editors
103130

104131
Please open a PR if you have a working configuration!

0 commit comments

Comments
 (0)