summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorShachaf Ben-Kiki <shachaf@gmail.com>2014-07-13 15:19:33 -0500
committerAustin Seipp <austin@well-typed.com>2014-07-13 15:19:33 -0500
commit1d71e96958cb4374b383e2f254b5358386bf835c (patch)
tree4627ad8b8c9586fab685235368c30a2d1661c521 /ghc
parent8af2f702210b359dad1e65fb029ddf934b967edc (diff)
downloadhaskell-1d71e96958cb4374b383e2f254b5358386bf835c.tar.gz
Fix ghci tab completion of duplicate identifiers.
Summary: Currently, if the same identifier is imported via multiple modules, ghci shows multiple completions for it. Use the nub of the completions instead so that it only shows up once. Signed-off-by: Shachaf Ben-Kiki <shachaf@gmail.com> Test Plan: by hand Reviewers: simonmar, austin, hvr Reviewed By: austin, hvr Subscribers: hvr, simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D58
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index c3d9f25754..ef48c348bd 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -2536,14 +2536,14 @@ unionComplete f1 f2 line = do
wrapCompleter :: String -> (String -> GHCi [String]) -> CompletionFunc GHCi
wrapCompleter breakChars fun = completeWord Nothing breakChars
- $ fmap (map simpleCompletion) . fmap sort . fun
+ $ fmap (map simpleCompletion . nubSort) . fun
wrapIdentCompleter :: (String -> GHCi [String]) -> CompletionFunc GHCi
wrapIdentCompleter = wrapCompleter word_break_chars
wrapIdentCompleterWithModifier :: String -> (Maybe Char -> String -> GHCi [String]) -> CompletionFunc GHCi
wrapIdentCompleterWithModifier modifChars fun = completeWordWithPrev Nothing word_break_chars
- $ \rest -> fmap (map simpleCompletion) . fmap sort . fun (getModifier rest)
+ $ \rest -> fmap (map simpleCompletion . nubSort) . fun (getModifier rest)
where
getModifier = find (`elem` modifChars)