Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

case sensitive language pragmas fix #2142

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -160,7 +160,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)
| otherwise
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 @@ -256,6 +256,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