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

Hole fits don't play well with the `--refinement-level-hole-fits=N` flag. #1563

Open Tritlo opened 4 years ago

Tritlo commented 4 years ago

Compiling

{-# OPTIONS_GHC -frefinement-level-hole-fits=1 #-}

module HF where

data M = MI Int | MC Char

f :: M
f = _a

And looking at the hole _a will suggest the following code actions:

replace hole `_a` with where id
replace hole `_a` with id (_
replace hole `_a` with where MC
replace hole `_a` with  MC (_
replace hole `_a` with where MI
replace hole `_a` with MI (_
replace hole `_a` with f

where the code action on e.g. the third will replace the hole with where MC and on the fourth with where MC (_, which aren't valid (and the braces aren't even closed in the second case!)

I suspect this has to do with the parsing of the hole fits.

jneira commented 4 years ago

Hi! thanks for report the issue, what os anf ghc/hie versions are you using?