Skip to content
Closed
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
39 changes: 37 additions & 2 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4056,7 +4056,8 @@ thLinkingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
completionTests :: TestTree
completionTests
= testGroup "completion"
[ testGroup "non local" nonLocalCompletionTests
[
testGroup "non local" nonLocalCompletionTests
, testGroup "topLevel" topLevelCompletionTests
, testGroup "local" localCompletionTests
, testGroup "package" packageCompletionTests
Expand Down Expand Up @@ -4590,7 +4591,41 @@ projectCompletionTests =
<- compls
, _label == "anidentifier"
]
liftIO $ compls' @?= ["Defined in 'A"],
liftIO $ compls' @?= ["Defined in 'A"],
testSession' "auto complete functions from qualified imports without alias" $ \dir-> do
liftIO $ writeFile (dir </> "hie.yaml")
"cradle: {direct: {arguments: [\"-Wmissing-signatures\", \"A\", \"B\"]}}"
_ <- createDoc "A.hs" "haskell" $ T.unlines
[ "module A (anidentifier) where",
"anidentifier = ()"
]
_ <- waitForDiagnostics
doc <- createDoc "B.hs" "haskell" $ T.unlines
[ "module B where",
"import qualified A",
"A."
]
compls <- getCompletions doc (Position 2 2)
let item = head compls
liftIO $ do
item ^. L.label @?= "anidentifier",
testSession' "auto complete functions from local qualified imports with alias" $ \dir-> do
liftIO $ writeFile (dir </> "hie.yaml")
"cradle: {direct: {arguments: [\"-Wmissing-signatures\", \"A\", \"B\"]}}"
_ <- createDoc "A.hs" "haskell" $ T.unlines
[ "module A (anidentifier) where",
"anidentifier = ()"
]
_ <- waitForDiagnostics
doc <- createDoc "B.hs" "haskell" $ T.unlines
[ "module B where",
"import qualified A as alias",
"alias."
]
compls <- getCompletions doc (Position 2 6)
let item = head compls
liftIO $ do
item ^. L.label @?= "anidentifier",
testSession' "auto complete project imports" $ \dir-> do
liftIO $ writeFile (dir </> "hie.yaml")
"cradle: {direct: {arguments: [\"-Wmissing-signatures\", \"ALocalModule\", \"B\"]}}"
Expand Down