Skip to content

Commit e27c1ed

Browse files
committed
Sort completions alphabetically
1 parent 7aaf777 commit e27c1ed

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,7 @@ getCompletions plId ideOpts CC {allModNamesAsNS, anyQualCompls, unqualCompls, qu
652652
-- 3. label alphabetical ordering next
653653
-- 4. module alphabetical ordering
654654
lexicographicOrdering Fuzzy.Scored{score_, original=(isQual, CompletionItem{_label,_detail})} =
655-
-- TODO uncomment the line below to sort alphabetically and fix tests
656-
Down isQual -- , Down score_, _label, _detail)
655+
(Down isQual, Down score_, _label, _detail)
657656

658657
uniqueCompl :: CompItem -> CompItem -> Ordering
659658
uniqueCompl candidate unique =

ghcide/test/exe/Main.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,10 +4315,9 @@ nonLocalCompletionTests =
43154315
],
43164316
completionTest
43174317
"type"
4318-
["{-# OPTIONS_GHC -Wall #-}", "module A () where", "f :: Bo", "f = True"]
4319-
(Position 2 7)
4320-
[ ("Bounded", CiInterface, "Bounded ${1:(*)}", True, True, Nothing),
4321-
("Bool", CiStruct, "Bool ", True, True, Nothing)
4318+
["{-# OPTIONS_GHC -Wall #-}", "module A () where", "f :: Boo", "f = True"]
4319+
(Position 2 8)
4320+
[ ("Bool", CiStruct, "Bool ", True, True, Nothing)
43224321
],
43234322
completionTest
43244323
"qualified"
@@ -4505,7 +4504,7 @@ otherCompletionTests = [
45054504
_ <- waitForDiagnostics
45064505
compls <- getCompletions docA $ Position 2 4
45074506
let compls' = [txt | CompletionItem {_insertText = Just txt, ..} <- compls, _label == "member"]
4508-
liftIO $ take 2 compls' @?= ["member ${1:Foo}", "member ${1:Bar}"],
4507+
liftIO $ take 2 compls' @?= ["member ${1:Bar}", "member ${1:Foo}"],
45094508

45104509
testSessionWait "maxCompletions" $ do
45114510
doc <- createDoc "A.hs" "haskell" $ T.unlines

0 commit comments

Comments
 (0)