@@ -404,32 +404,31 @@ missingPragmaTests = testGroup "missing pragma warning code actions" [
404
404
405
405
unusedTermTests :: TestTree
406
406
unusedTermTests = testGroup " unused term code actions" [
407
- -- ignoreTestBecause "Broken" $ testCase "Prefixes with '_'" $ pendingWith "removed because of HaRe"
408
- -- runSession hlsCommand fullCaps "test/testdata/" $ do
409
- -- doc <- openDoc "UnusedTerm.hs" "haskell"
410
- --
411
- -- _ <- waitForDiagnosticsSource "typecheck"
412
- -- cas <- map fromAction <$> getAllCodeActions doc
413
- --
414
- -- liftIO $ map (^. L.title) cas `shouldContain` [ "Prefix imUnused with _"]
415
- --
416
- -- executeCodeAction $ head cas
417
- --
418
- -- edit <- skipManyTill anyMessage $ getDocumentEdit doc
419
- --
420
- -- let expected = [ "{-# OPTIONS_GHC -Wall #-}"
421
- -- , "module UnusedTerm () where"
422
- -- , "_imUnused :: Int -> Int"
423
- -- , "_imUnused 1 = 1"
424
- -- , "_imUnused 2 = 2"
425
- -- , "_imUnused _ = 3"
426
- -- ]
427
- --
428
- -- liftIO $ edit @?= T.unlines expected
407
+ ignoreTestBecause " no support for prefixing unused names with _" $ testCase " Prefixes with '_'" $
408
+ runSession hlsCommand fullCaps " test/testdata/" $ do
409
+ doc <- openDoc " UnusedTerm.hs" " haskell"
410
+
411
+ _ <- waitForDiagnosticsSource " typecheck"
412
+ cars <- getAllCodeActions doc
413
+ prefixImUnused <- liftIO $ inspectCodeAction cars [" Prefix imUnused with _" ]
414
+
415
+ executeCodeAction prefixImUnused
416
+
417
+ edit <- skipManyTill anyMessage $ getDocumentEdit doc
418
+
419
+ let expected = [ " {-# OPTIONS_GHC -Wall #-}"
420
+ , " module UnusedTerm () where"
421
+ , " _imUnused :: Int -> Int"
422
+ , " _imUnused 1 = 1"
423
+ , " _imUnused 2 = 2"
424
+ , " _imUnused _ = 3"
425
+ ]
426
+
427
+ liftIO $ edit @?= T. unlines expected
429
428
430
429
-- See https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_codeAction
431
430
-- `CodeActionContext`
432
- testCase " respect 'only' parameter" $ runSession hlsCommand fullCaps " test/testdata" $ do
431
+ , testCase " respect 'only' parameter" $ runSession hlsCommand fullCaps " test/testdata" $ do
433
432
doc <- openDoc " CodeActionOnly.hs" " haskell"
434
433
_ <- waitForDiagnostics
435
434
diags <- getCurrentDiagnostics doc
0 commit comments