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