@@ -10,7 +10,7 @@ module Development.IDE.Plugin.Plugins.ImportUtils
10
10
import Data.List.NonEmpty (NonEmpty ((:|) ))
11
11
import qualified Data.Text as T
12
12
import Development.IDE.Plugin.CodeAction.ExactPrint (wildCardSymbol )
13
- import Development.IDE.Types.Exports ( IdentInfo ( .. ))
13
+ import Development.IDE.Types.Exports
14
14
import Language.LSP.Types (CodeActionKind (.. ))
15
15
16
16
-- | Possible import styles for an 'IdentInfo'.
@@ -49,16 +49,18 @@ data ImportStyle
49
49
deriving Show
50
50
51
51
importStyles :: IdentInfo -> NonEmpty ImportStyle
52
- importStyles IdentInfo {parent, rendered, isDatacon}
53
- | Just p <- parent
52
+ importStyles i @ ( IdentInfo {parent})
53
+ | Just p <- pr
54
54
-- Constructors always have to be imported via their parent data type, but
55
55
-- methods and associated type/data families can also be imported as
56
56
-- top-level exports.
57
- = ImportViaParent rendered p
58
- :| [ImportTopLevel rendered | not isDatacon]
57
+ = ImportViaParent rend p
58
+ :| [ImportTopLevel rend | not ( isDatacon i) ]
59
59
<> [ImportAllConstructors p]
60
60
| otherwise
61
- = ImportTopLevel rendered :| []
61
+ = ImportTopLevel rend :| []
62
+ where rend = rendered i
63
+ pr = occNameText <$> parent
62
64
63
65
-- | Used for adding new imports
64
66
renderImportStyle :: ImportStyle -> T. Text
0 commit comments