File tree 4 files changed +22
-1
lines changed
plugins/hls-pragmas-plugin
4 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,16 @@ suggest dflags diag =
81
81
82
82
suggestDisableWarning :: Diagnostic -> [PragmaEdit ]
83
83
suggestDisableWarning Diagnostic {_code}
84
- | Just (J. InR (T. stripPrefix " -W" -> Just w)) <- _code =
84
+ | Just (J. InR (T. stripPrefix " -W" -> Just w)) <- _code
85
+ , w `notElem` warningBlacklist =
85
86
pure (" Disable \" " <> w <> " \" warnings" , OptGHC w)
86
87
| otherwise = []
87
88
89
+ -- Don't suggest disabling type errors as a solution to all type errors
90
+ warningBlacklist :: [T. Text ]
91
+ -- warningBlacklist = []
92
+ warningBlacklist = [" deferred-type-errors" ]
93
+
88
94
-- ---------------------------------------------------------------------
89
95
90
96
-- | Offer to add a missing Language Pragma to the top of a file.
Original file line number Diff line number Diff line change @@ -123,6 +123,13 @@ codeActionTests =
123
123
cas <- map fromAction <$> getAllCodeActions doc
124
124
liftIO $ " Disable \" unused-imports\" warnings" `elem` map (^. L. title) cas @? " Contains unused-imports code action"
125
125
executeCodeAction $ head cas
126
+
127
+ , goldenWithPragmas " doesn't suggest disabling type errors" " DeferredTypeErrors" $ \ doc -> do
128
+
129
+ _ <- waitForDiagnosticsFrom doc
130
+ cas <- map fromAction <$> getAllCodeActions doc
131
+ liftIO $ " Disable \" deferred-type-errors\" warnings" `notElem` map (^. L. title) cas @? " Doesn't contain deferred-type-errors code action"
132
+ liftIO $ length cas == 0 @? " Expected no code actions, but got: " <> show cas
126
133
]
127
134
128
135
completionTests :: TestTree
Original file line number Diff line number Diff line change
1
+ module DeferredTypeErrors where
2
+
3
+ foo :: Int
4
+ foo = ()
Original file line number Diff line number Diff line change
1
+ module DeferredTypeErrors where
2
+
3
+ foo :: Int
4
+ foo = ()
You can’t perform that action at this time.
0 commit comments