Ghcide: Hole suggestions doesn't properly qualify the result

Created on 11 Aug 2020  ·  5Comments  ·  Source: haskell/ghcide

If I import a module qualified

import qualified Data.List as L

and then ask vscode to fill a hole with something from there

myTails :: [a] -> [[a]]
myTails = _

it will pretend that it was available unqualified

myTails :: [a] -> [[a]]
myTails = tails

which Haskell will complain about again, but fortunately ghcide gives a suggestion to automatically fix it, so after another ⌘-. <Enter> I will end up with what I wanted.

myTails :: [a] -> [[a]]
myTails = L.tails

The last step shouldn't be needed though.

bug

Most helpful comment

I'm working on a fix for this

All 5 comments

@tritlo reported this, including a live demo: https://youtu.be/lfrk0wyZHvg?t=2311

@Tritlo reported this, including a live demo: https://youtu.be/lfrk0wyZHvg?t=2311

Yeah, except I didn't even get the suggestion to update it!

Yeah, except I didn't even get the suggestion to update it!

Right, because for you there was already another value in scope with that name, so it becomes a type error instead of an “undefined variable” error. Type errors doesn’t (currently) suggest similarly named functions with the correct type.

Qualifiers in GHC error messages are getting munged before code actions have a chance to see them.
I traced this back to #546. Reverting that commit will fix this issue, #652 and probably others. However it will also make error messages materially worse.

I'm working on a fix for this

Was this page helpful?
0 / 5 - 0 ratings