Fix duplicated completions (#837)

Co-authored-by: Vitalii Ovechkin <ovechkinve@yandex-team.ru>
This commit is contained in:
Vitalii 2020-09-28 11:23:12 +03:00 committed by GitHub
parent b279afbce7
commit 85f3738e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -482,9 +482,10 @@ getCompletions ideOpts CC { allModNamesAsNS, unqualCompls, qualCompls, importabl
| "{-# " `T.isPrefixOf` fullLine | "{-# " `T.isPrefixOf` fullLine
= filtPragmaCompls (pragmaSuffix fullLine) = filtPragmaCompls (pragmaSuffix fullLine)
| otherwise | otherwise
= filtModNameCompls ++ map (toggleSnippets caps withSnippets = let uniqueFiltCompls = nubOrdOn insertText filtCompls
. mkCompl ideOpts . stripAutoGenerated) filtCompls in filtModNameCompls ++ map (toggleSnippets caps withSnippets
++ filtKeywordCompls . mkCompl ideOpts . stripAutoGenerated) uniqueFiltCompls
++ filtKeywordCompls
return result return result

View File

@ -2660,6 +2660,12 @@ nonLocalCompletionTests =
["{-# OPTIONS_GHC -Wunused-binds #-}", "module A () where", "f = Prelude.hea"] ["{-# OPTIONS_GHC -Wunused-binds #-}", "module A () where", "f = Prelude.hea"]
(Position 2 15) (Position 2 15)
[ ("head", CiFunction, True, True) [ ("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)
] ]
] ]