Description
Is your feature request related to a problem? Please describe.
At the moment, the ‘Define <function>’ code action is hardcoded to produce name <> " = error \"not implemented\""
as the body of the function:
haskell-language-server/ghcide/src/Development/IDE/Plugin/CodeAction.hs
Lines 683 to 685 in 65a8512
This is mostly satisfactory — but has the disadvantage of not producing a compiler error. If defining several new functions at once, it is easy to forget to go back and fill it in.
Describe the solution you'd like
It would be nice to have the option to define the function as a typed hole — so something like:
= [ ("Define " <> sig
, [TextEdit (Range nextLineP nextLineP) (T.unlines ["", sig, name <> " = error \"not implemented\""])]
+ )
+ , ("Define " <> sig <> " as typed hole"
+ , [TextEdit (Range nextLineP nextLineP) (T.unlines ["", sig, name <> " = _"])]
)]
This would provide an easy way to reduce the number of code errors. It also provides a better UX: in my editor (Emacs), for instance, it would let me jump to and from the new function using flycheck-next-error
etc.