This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/Haskell/Ide/Engine/Plugin Expand file tree Collapse file tree 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
1313import Control.Monad
1414import Data.Aeson
1515import Data.Foldable
16+ import Data.List ( partition )
1617import Data.Maybe
1718#if __GLASGOW_HASKELL__ < 808
1819import Data.Monoid ( (<>) )
@@ -294,12 +295,18 @@ codeActionProvider plId docId _ context = do
294295 -- Diagnostic that is supposed to import the appropriate term.
295296 --
296297 -- 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.
297301 importActionsForTerms
298302 :: SearchStyle -> [ImportDiagnostic ] -> IdeM [J. CodeAction ]
299303 importActionsForTerms style importDiagnostics = do
300304 let searchTerms = map (applySearchStyle style . term) importDiagnostics
301305 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
303310 concat <$> mapM (uncurry (termToActions style)) importTerms
304311
305312 -- | Apply the search style to given term.
You can’t perform that action at this time.
0 commit comments