This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree 1 file changed +8
-1
lines changed
src/Haskell/Ide/Engine/Plugin 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import Control.Monad.IO.Class
13
13
import Control.Monad
14
14
import Data.Aeson
15
15
import Data.Foldable
16
+ import Data.List ( partition )
16
17
import Data.Maybe
17
18
#if __GLASGOW_HASKELL__ < 808
18
19
import Data.Monoid ( (<>) )
@@ -294,12 +295,18 @@ codeActionProvider plId docId _ context = do
294
295
-- Diagnostic that is supposed to import the appropriate term.
295
296
--
296
297
-- Result may produce several import actions, or none.
298
+ --
299
+ -- Actions which import from a module whose name components contain
300
+ -- 'Internal' are returned last for each diagnostic.
297
301
importActionsForTerms
298
302
:: SearchStyle -> [ImportDiagnostic ] -> IdeM [J. CodeAction ]
299
303
importActionsForTerms style importDiagnostics = do
300
304
let searchTerms = map (applySearchStyle style . term) importDiagnostics
301
305
searchResults <- mapM Hoogle. searchModules' searchTerms
302
- let importTerms = zip searchResults importDiagnostics
306
+ let deprioritizeInternal = uncurry (++)
307
+ . partition ((" Internal" `notElem` ) . T. splitOn " ." . fst )
308
+ prioritizedSearchResults = deprioritizeInternal <$> searchResults
309
+ importTerms = zip prioritizedSearchResults importDiagnostics
303
310
concat <$> mapM (uncurry (termToActions style)) importTerms
304
311
305
312
-- | Apply the search style to given term.
You can’t perform that action at this time.
0 commit comments