lsp-haskell icon indicating copy to clipboard operation
lsp-haskell copied to clipboard

Add interactive command for case splitting

Open TOTBWF opened this issue 3 years ago • 3 comments

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 avatar Feb 27 '21 22:02 TOTBWF

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

TOTBWF avatar Feb 27 '21 22:02 TOTBWF

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?

michaelpj avatar Feb 28 '21 11:02 michaelpj

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

isovector avatar May 28 '21 19:05 isovector