haskell / haskell-ide-engine

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

Re-implement SplitCase Cmd #1518

Open fendor opened 4 years ago

fendor commented 4 years ago

Command was removed, and should be implemented again. There is some old code in https://github.com/haskell/haskell-ide-engine/blob/master/src/Haskell/Ide/Engine/Support/HieExtras.hs#L382 that could be useful. Or maybe not.

alanz commented 4 years ago

If I recall this was based on some code added to ghc-mod which used a library which is not very well maintained. Or the original one, anyway. I suspect/hope GHC now provides better information to be able to do this.

theobat commented 4 years ago

Is it possible to get any further explanation ? (It's marked "good first issue" but I don't grasp what's expected) Repo serach yields: https://github.com/haskell/haskell-ide-engine/search?q=splitCaseCmd&unscoped_q=splitCaseCmd is the first description the right one ?

  , PluginCommand "casesplit" "Generate a pattern match for a binding under (LINE,COL)" splitCaseCmd
fendor commented 4 years ago

Hi! The reason this is marked as a good first issue is that it is isolated and does not require knowledge about lsp or how hie works internally. However, the implementation is not straight forward, in my opinion and requires some knowledge about ghc, or at least the will to work with the ghc lib. The given description is how I would understand it, too. Example:

foo :: Maybe a -> Int
foo x = 5

After splitCaseCmd has been applied to x:

foo :: Maybe a -> Int
foo Nothing = 5
foo (Just y) = 5

@alanz please correct me if i am wrong @mpickering IIRC, you had some more implementation pointers?