Skip to content

Commit a4fe2bf

Browse files
committed
fixes
1 parent f9008fe commit a4fe2bf

File tree

1 file changed

+8
-6
lines changed
  • plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins

1 file changed

+8
-6
lines changed

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/ImportUtils.hs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Development.IDE.Plugin.Plugins.ImportUtils
1010
import Data.List.NonEmpty (NonEmpty ((:|)))
1111
import qualified Data.Text as T
1212
import Development.IDE.Plugin.CodeAction.ExactPrint (wildCardSymbol)
13-
import Development.IDE.Types.Exports (IdentInfo (..))
13+
import Development.IDE.Types.Exports
1414
import Language.LSP.Types (CodeActionKind (..))
1515

1616
-- | Possible import styles for an 'IdentInfo'.
@@ -49,16 +49,18 @@ data ImportStyle
4949
deriving Show
5050

5151
importStyles :: 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
6466
renderImportStyle :: ImportStyle -> T.Text

0 commit comments

Comments
 (0)