diff --git a/plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs b/plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs index a939cf57bb..af01fea2d6 100644 --- a/plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs +++ b/plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs @@ -163,7 +163,7 @@ completion _ide _ complParams = do result <$> VFS.getCompletionPrefix position cnts where result (Just pfix) - | "{-# LANGUAGE" `T.isPrefixOf` VFS.fullLine pfix + | "{-# language" `T.isPrefixOf` T.toLower (VFS.fullLine pfix) = J.List $ map buildCompletion (Fuzzy.simpleFilter (VFS.prefixText pfix) allPragmas) | "{-# options_ghc" `T.isPrefixOf` T.toLower (VFS.fullLine pfix) diff --git a/plugins/hls-pragmas-plugin/test/Main.hs b/plugins/hls-pragmas-plugin/test/Main.hs index fb239f16d5..e6f5595bf3 100644 --- a/plugins/hls-pragmas-plugin/test/Main.hs +++ b/plugins/hls-pragmas-plugin/test/Main.hs @@ -258,6 +258,18 @@ completionTests = item ^. L.label @?= "OverloadedStrings" item ^. L.kind @?= Just CiKeyword + + , testCase "completes language extensions case insensitive" $ runSessionWithServer pragmasPlugin testDataDir $ do + doc <- openDoc "Completion.hs" "haskell" + _ <- waitForDiagnostics + let te = TextEdit (Range (Position 0 4) (Position 0 34)) "lAnGuaGe Overloaded" + _ <- applyEdit doc te + compls <- getCompletions doc (Position 0 24) + let item = head $ filter ((== "OverloadedStrings") . (^. L.label)) compls + liftIO $ do + item ^. L.label @?= "OverloadedStrings" + item ^. L.kind @?= Just CiKeyword + , testCase "completes the Strict language extension" $ runSessionWithServer pragmasPlugin testDataDir $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnostics