haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

Generate casesplit codeAction properly #920

Open alanz opened 6 years ago

alanz commented 6 years ago

917 introduced code to generate a code action to split a case, but it does not work.

Fix it.

Avi-D-coder commented 6 years ago

Are you saying make a diagnostic or underlined lint of some kind on any arguments that can be split; such that the light bulb will show up in vscode? The action it's self works for me just like delete definition or lift one ...

alanz commented 6 years ago

That's strange, the action does not show up for me, using the code that you test against.

I think it is the way the case is set up, which as I understand it will either generate the refactoring commands or the case split, but never both.

Avi-D-coder commented 6 years ago

It generates the action when your cursor is over argument, because that's where the command splitCaseCmd works. The refactoring commands are generated under the same condition as before (when over a definition). The casesplit code action is generated when over a symbol that is not a definition. Take a look at Avi-D-coder/haskell-ide-engine@9e1dca2f2edfa814e5212958f0da0076c2620352. I got rid of the nested case statements and added more descriptive names and comments.