Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wingman: add emacs example config to Readme #1988

Merged
merged 2 commits into from
Jun 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions plugins/hls-tactics-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,33 @@ function! s:WingmanUseCtor(type)
endfunction
```

### Emacs

When using Emacs, wingman actions should be available out-of-the-box and
show up e.g. when using `M-x helm-lsp-code-actions RET` provided by
[helm-lsp](https://github.com/emacs-lsp/helm-lsp) or as popups via
[lsp-ui-sideline](https://emacs-lsp.github.io/lsp-ui/#lsp-ui-sideline).

Additionally, if you want to bind wingman actions directly to specific
keybindings or use them from Emacs Lisp, you can do so like this:

``` emacs-lisp
;; will define elisp functions for the given lsp code actions, prefixing the
;; given function names with "lsp"
(lsp-make-interactive-code-action wingman-fill-hole "refactor.wingman.fillHole")
(lsp-make-interactive-code-action wingman-case-split "refactor.wingman.caseSplit")
(lsp-make-interactive-code-action wingman-refine "refactor.wingman.refine")
(lsp-make-interactive-code-action wingman-split-func-args "refactor.wingman.spltFuncArgs")
(lsp-make-interactive-code-action wingman-use-constructor "refactor.wingman.useConstructor")

;; example key bindings
(define-key haskell-mode-map (kbd "C-c d") #'lsp-wingman-case-split)
(define-key haskell-mode-map (kbd "C-c n") #'lsp-wingman-fill-hole)
(define-key haskell-mode-map (kbd "C-c r") #'lsp-wingman-refine)
(define-key haskell-mode-map (kbd "C-c c") #'lsp-wingman-use-constructor)
(define-key haskell-mode-map (kbd "C-c a") #'lsp-wingman-split-func-args)
```

### Other Editors

Please open a PR if you have a working configuration!
Expand Down