diff --git a/ghcide/test/exe/Main.hs b/ghcide/test/exe/Main.hs index 29401292f2..b5b11ddb30 100644 --- a/ghcide/test/exe/Main.hs +++ b/ghcide/test/exe/Main.hs @@ -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 @@ -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\"]}}"