@@ -32,6 +32,54 @@ codeActionTests =
32
32
liftIO $ " Add \" FlexibleInstances\" " `elem` map (^. L. title) cas @? " Contains FlexibleInstances code action"
33
33
executeCodeAction $ head cas
34
34
35
+ , goldenWithPragmas " adds LANGUAGE pragma after shebang and last language pragma" " AfterShebangAndPragma" $ \ doc -> do
36
+ _ <- waitForDiagnosticsFrom doc
37
+ cas <- map fromAction <$> getAllCodeActions doc
38
+ liftIO $ " Add \" NamedFieldPuns\" " `elem` map (^. L. title) cas @? " Contains NamedFieldPuns code action"
39
+ executeCodeAction $ head cas
40
+
41
+ , goldenWithPragmas " adds above module keyword on first line" " ModuleOnFirstLine" $ \ doc -> do
42
+ _ <- waitForDiagnosticsFrom doc
43
+ cas <- map fromAction <$> getAllCodeActions doc
44
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
45
+ executeCodeAction $ head cas
46
+
47
+ , goldenWithPragmas " adds LANGUAGE pragma after GHC_OPTIONS" " AfterGhcOptions" $ \ doc -> do
48
+ _ <- waitForDiagnosticsFrom doc
49
+ cas <- map fromAction <$> getAllCodeActions doc
50
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
51
+ executeCodeAction $ head cas
52
+
53
+ , goldenWithPragmas " adds LANGUAGE pragma after shebang and GHC_OPTIONS" " AfterShebangAndOpts" $ \ doc -> do
54
+ _ <- waitForDiagnosticsFrom doc
55
+ cas <- map fromAction <$> getAllCodeActions doc
56
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
57
+ executeCodeAction $ head cas
58
+
59
+ , goldenWithPragmas " adds LANGUAGE pragma after shebang, GHC_OPTIONS and language pragma" " AfterShebangAndOptionsAndPragma" $ \ doc -> do
60
+ _ <- waitForDiagnosticsFrom doc
61
+ cas <- map fromAction <$> getAllCodeActions doc
62
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
63
+ executeCodeAction $ head cas
64
+
65
+ , goldenWithPragmas " adds LANGUAGE pragma after all others ignoring later INLINE pragma" " AfterShebangAndOptionsAndPragmasIgnoreInline" $ \ doc -> do
66
+ _ <- waitForDiagnosticsFrom doc
67
+ cas <- map fromAction <$> getAllCodeActions doc
68
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
69
+ executeCodeAction $ head cas
70
+
71
+ , goldenWithPragmas " adds LANGUAGE pragma after all others ignoring multiple later INLINE pragma" " AfterAllWithMultipleInlines" $ \ doc -> do
72
+ _ <- waitForDiagnosticsFrom doc
73
+ cas <- map fromAction <$> getAllCodeActions doc
74
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
75
+ executeCodeAction $ head cas
76
+
77
+ , goldenWithPragmas " adds LANGUAGE pragma correctly ignoring later INLINE pragma" " AddLanguagePragma" $ \ doc -> do
78
+ _ <- waitForDiagnosticsFrom doc
79
+ cas <- map fromAction <$> getAllCodeActions doc
80
+ liftIO $ " Add \" TupleSections\" " `elem` map (^. L. title) cas @? " Contains TupleSections code action"
81
+ executeCodeAction $ head cas
82
+
35
83
, goldenWithPragmas " adds TypeApplications pragma" " TypeApplications" $ \ doc -> do
36
84
_ <- waitForDiagnosticsFrom doc
37
85
cas <- map fromAction <$> getAllCodeActions doc
0 commit comments