Skip to content

Commit e0eb90a

Browse files
committed
refactor: Makes mapNotInScope local and renames to qualify
1 parent d96d470 commit e0eb90a

File tree

1 file changed

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

1 file changed

+5
-6
lines changed

Diff for: plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1503,12 +1503,16 @@ suggestNewImport df packageExportsMap ps fileContents Diagnostic{..}
15031503
| GHC94 <- ghcVersion
15041504
, isNothing (qual <|> qual')
15051505
, Just q <- qualGHC94 =
1506-
mapNotInScope ((q <> ".") <>) thingMissing
1506+
qualify q thingMissing
15071507
| otherwise = thingMissing
15081508
suggestions = nubSortBy simpleCompareImportSuggestion
15091509
(constructNewImportSuggestions packageExportsMap (qual <|> qual' <|> qualGHC94, missing) extendImportSuggestions qis) in
15101510
map (\(ImportSuggestion _ kind (unNewImport -> imp)) -> (imp, kind, TextEdit range (imp <> "\n" <> T.replicate indent " "))) suggestions
15111511
where
1512+
qualify q (NotInScopeDataConstructor d) = NotInScopeDataConstructor (q <> "." <> d)
1513+
qualify q (NotInScopeTypeConstructorOrClass d) = NotInScopeTypeConstructorOrClass (q <> "." <> d)
1514+
qualify q (NotInScopeThing d) = NotInScopeThing (q <> "." <> d)
1515+
15121516
L _ HsModule {..} = astA ps
15131517
suggestNewImport _ _ _ _ _ = []
15141518

@@ -1815,11 +1819,6 @@ data NotInScope
18151819
| NotInScopeThing T.Text
18161820
deriving Show
18171821

1818-
mapNotInScope :: (T.Text -> T.Text) -> NotInScope -> NotInScope
1819-
mapNotInScope f (NotInScopeDataConstructor d) = NotInScopeDataConstructor (f d)
1820-
mapNotInScope f (NotInScopeTypeConstructorOrClass d) = NotInScopeTypeConstructorOrClass (f d)
1821-
mapNotInScope f (NotInScopeThing d) = NotInScopeThing (f d)
1822-
18231822
notInScope :: NotInScope -> T.Text
18241823
notInScope (NotInScopeDataConstructor t) = t
18251824
notInScope (NotInScopeTypeConstructorOrClass t) = t

0 commit comments

Comments
 (0)