rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 95 forks source link

QuickFix "import" wrongfully adds second pair of parenthesis #317

Open sir4ur0n opened 5 years ago

sir4ur0n commented 5 years ago

Example:

import           GHC.Generics        (from)

data Foo = Foo
  { bar :: String
  } deriving (Eq, Show, Generic)

Generic has a red squiggly line because it is not imported. Using the quickfix Import Generic of module GHC.Generics results in

import           GHC.Generics        (from,(Generic))

data Foo = Foo
  { bar :: String
  } deriving (Eq, Show, Generic)

Which doesn't compile, it should be (from, Generic).

rikvdkleij commented 5 years ago

Thanks for your example.

There are similar issues of using quickfix/optimize. Need some time to fix them all but it not so simple to solve (I guess).

rikvdkleij commented 5 years ago

Should be fixed in beta36.

sir4ur0n commented 5 years ago

Found an edge case that doesn't work well:

import Data.Aeson.Casing ()

-- Use snakeCase somewhere and use the quickfix to add it to imports

After quickfix/import of snakeCase:

import Data.Aeson.Casing ()
import Data.Aeson.Casing (snakeCase)