Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions plugins/hls-pragmas-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down