@@ -10,7 +10,7 @@ module Development.IDE.Plugin.Plugins.ImportUtils
1010import Data.List.NonEmpty (NonEmpty ((:|) ))
1111import qualified Data.Text as T
1212import Development.IDE.Plugin.CodeAction.ExactPrint (wildCardSymbol )
13- import Development.IDE.Types.Exports ( IdentInfo ( .. ))
13+ import Development.IDE.Types.Exports
1414import Language.LSP.Types (CodeActionKind (.. ))
1515
1616-- | Possible import styles for an 'IdentInfo'.
@@ -49,16 +49,18 @@ data ImportStyle
4949 deriving Show
5050
5151importStyles :: IdentInfo -> NonEmpty ImportStyle
52- importStyles IdentInfo {parent, rendered, isDatacon}
53- | Just p <- parent
52+ importStyles i @ ( IdentInfo {parent})
53+ | Just p <- pr
5454 -- Constructors always have to be imported via their parent data type, but
5555 -- methods and associated type/data families can also be imported as
5656 -- top-level exports.
57- = ImportViaParent rendered p
58- :| [ImportTopLevel rendered | not isDatacon]
57+ = ImportViaParent rend p
58+ :| [ImportTopLevel rend | not ( isDatacon i) ]
5959 <> [ImportAllConstructors p]
6060 | otherwise
61- = ImportTopLevel rendered :| []
61+ = ImportTopLevel rend :| []
62+ where rend = rendered i
63+ pr = occNameText <$> parent
6264
6365-- | Used for adding new imports
6466renderImportStyle :: ImportStyle -> T. Text
0 commit comments