@@ -74,7 +74,7 @@ import Language.LSP.Types hiding
74
74
SemanticTokensEdit (_start),
75
75
mkRange)
76
76
import Language.LSP.Types.Capabilities
77
- import qualified Language.LSP.Types.Lens as Lens (label)
77
+ import qualified Language.LSP.Types.Lens as Lens (label, insertText )
78
78
import qualified Language.LSP.Types.Lens as Lsp (diagnostics,
79
79
message,
80
80
params)
@@ -4781,11 +4781,8 @@ completionNoCommandTest name src pos wanted = testSession name $ do
4781
4781
docId <- createDoc "A.hs" "haskell" (T.unlines src)
4782
4782
_ <- waitForDiagnostics
4783
4783
compls <- getCompletions docId pos
4784
- let wantedC = find ( \case
4785
- CompletionItem {_insertText = Just x} -> wanted `T.isPrefixOf` x
4786
- _ -> False
4787
- ) compls
4788
- case wantedC of
4784
+ let isPrefixOfInsertOrLabel ci = any (wanted `T.isPrefixOf`) [fromMaybe "" (ci ^. Lens.insertText), ci ^. Lens.label]
4785
+ case find isPrefixOfInsertOrLabel compls of
4789
4786
Nothing ->
4790
4787
liftIO $ assertFailure $ "Cannot find expected completion in: " <> show [_label | CompletionItem {_label} <- compls]
4791
4788
Just CompletionItem{..} -> liftIO . assertBool ("Expected no command but got: " <> show _command) $ null _command
@@ -5042,6 +5039,19 @@ nonLocalCompletionTests =
5042
5039
"join"
5043
5040
["{-# LANGUAGE NoImplicitPrelude #-}",
5044
5041
"module A where", "import Control.Monad as M ()", "import Control.Monad as N (join)", "f = N.joi"]
5042
+ -- Failing test for https://github.com/haskell/haskell-language-server/issues/2824
5043
+ , expectFailBecause "known broken #2824" $ completionNoCommandTest
5044
+ "explicit qualified"
5045
+ ["{-# LANGUAGE NoImplicitPrelude #-}",
5046
+ "module A where", "import qualified Control.Monad as M (j)"]
5047
+ (Position 2 38)
5048
+ "join"
5049
+ , completionNoCommandTest
5050
+ "explicit qualified post"
5051
+ ["{-# LANGUAGE NoImplicitPrelude, ImportQualifiedPost #-}",
5052
+ "module A where", "import Control.Monad qualified as M (j)"]
5053
+ (Position 2 38)
5054
+ "join"
5045
5055
]
5046
5056
, testGroup "Data constructor"
5047
5057
[ completionCommandTest
0 commit comments