emacs-lsp / lsp-haskell

lsp-mode :heart: haskell
https://emacs-lsp.github.io/lsp-haskell
GNU General Public License v3.0
236 stars 62 forks source link

Add interactive command for case splitting #112

Open TOTBWF opened 3 years ago

TOTBWF commented 3 years ago

Description

This PR adds an interactive function for performing case splits. To use it, simply place your cursor over a typed hole, and call lsp-haskell-case-split. You should be prompted for a list of identifiers, and selecting one from that list will case split on it.

Notes

It would be nice if lsp-mode provided a version of lsp--select-action that offered the ability to have a custom prompt/transformation function. If such a function is written, this code should be updated to use it.

TOTBWF commented 3 years ago

Build failures are unrelated to this change. Looks like something is up with the spinner package.

michaelpj commented 3 years ago

Dumb question, since I haven't used any of this yet, but what does this offer over just using the normal methods to trigger the code action? Is it that this is a particular combination that you want to trigger a lot, and so it's nice to have a specific function or keybinding for it?

isovector commented 3 years ago

FWIW, this is now implemented directly in HLS, under a code action with kind refactor.wingman.caseSplit