Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Remove duplicated completions #837

Merged
merged 1 commit into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,10 @@ getCompletions ideOpts CC { allModNamesAsNS, unqualCompls, qualCompls, importabl
| "{-# " `T.isPrefixOf` fullLine
= filtPragmaCompls (pragmaSuffix fullLine)
| otherwise
= filtModNameCompls ++ map (toggleSnippets caps withSnippets
. mkCompl ideOpts . stripAutoGenerated) filtCompls
++ filtKeywordCompls
= let uniqueFiltCompls = nubOrdOn insertText filtCompls
in filtModNameCompls ++ map (toggleSnippets caps withSnippets
. mkCompl ideOpts . stripAutoGenerated) uniqueFiltCompls
++ filtKeywordCompls

return result

Expand Down
6 changes: 6 additions & 0 deletions test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,12 @@ nonLocalCompletionTests =
["{-# OPTIONS_GHC -Wunused-binds #-}", "module A () where", "f = Prelude.hea"]
(Position 2 15)
[ ("head", CiFunction, True, True)
],
completionTest
"duplicate import"
["module A where", "import Data.List", "import Data.List", "f = perm"]
(Position 3 8)
[ ("permutations", CiFunction, False, False)
]
]

Expand Down