mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-02 08:53:07 +03:00
Fix duplicated completions (#837)
Co-authored-by: Vitalii Ovechkin <ovechkinve@yandex-team.ru>
This commit is contained in:
parent
b279afbce7
commit
85f3738e82
@ -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
|
||||
|
||||
|
@ -2660,6 +2660,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)
|
||||
]
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user