File tree Expand file tree Collapse file tree 4 files changed +22
-1
lines changed
plugins/hls-pragmas-plugin Expand file tree Collapse file tree 4 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,16 @@ suggest dflags diag =
8181
8282suggestDisableWarning :: Diagnostic -> [PragmaEdit ]
8383suggestDisableWarning 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 =
8586 pure (" Disable \" " <> w <> " \" warnings" , OptGHC w)
8687 | otherwise = []
8788
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+
8894-- ---------------------------------------------------------------------
8995
9096-- | 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 =
123123 cas <- map fromAction <$> getAllCodeActions doc
124124 liftIO $ " Disable \" unused-imports\" warnings" `elem` map (^. L. title) cas @? " Contains unused-imports code action"
125125 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
126133 ]
127134
128135completionTests :: 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