hls-hlint-plugin 2.1.0.0 → 2.2.0.0
raw patch · 2 files changed
+15/−13 lines, 2 filesdep ~ghcidedep ~hls-plugin-apidep ~hls-test-utilsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghcide, hls-plugin-api, hls-test-utils
API changes (from Hackage documentation)
Files
- hls-hlint-plugin.cabal +4/−4
- test/Main.hs +11/−9
hls-hlint-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-hlint-plugin-version: 2.1.0.0+version: 2.2.0.0 synopsis: Hlint integration plugin with Haskell Language Server description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -45,10 +45,10 @@ , extra , filepath , ghc-exactprint >=0.6.3.4- , ghcide == 2.1.0.0+ , ghcide == 2.2.0.0 , hashable , hlint < 3.7- , hls-plugin-api == 2.1.0.0+ , hls-plugin-api == 2.2.0.0 , lens , lsp , mtl@@ -89,7 +89,7 @@ , filepath , hls-hlint-plugin , hls-plugin-api- , hls-test-utils == 2.1.0.0+ , hls-test-utils == 2.2.0.0 , lens , lsp-types , row-types
test/Main.hs view
@@ -121,7 +121,7 @@ contents <- skipManyTill anyMessage $ getDocumentEdit doc liftIO $ contents @?= "main = undefined\nfoo x = x\n" - , testCase "falls back to pre 3.8 code actions" $ runSessionWithServerAndCaps hlintPlugin noLiteralCaps "test/testdata" $ do+ , testCase "falls back to pre 3.8 code actions" $ runSessionWithServerAndCaps def hlintPlugin noLiteralCaps "test/testdata" $ do doc <- openDoc "Base.hs" "haskell" _ <- waitForDiagnosticsFromSource doc "hlint"@@ -303,6 +303,7 @@ configTests = testGroup "hlint plugin config" [ testCase "changing hlint plugin configuration enables or disables hlint diagnostics" $ runHlintSession "" $ do+ setIgnoringConfigurationRequests False enableHlint doc <- openDoc "Base.hs" "haskell"@@ -315,19 +316,21 @@ liftIO $ noHlintDiagnostics diags' , testCase "adding hlint flags to plugin configuration removes hlint diagnostics" $ runHlintSession "" $ do+ setIgnoringConfigurationRequests False enableHlint doc <- openDoc "Base.hs" "haskell" testHlintDiagnostics doc let config' = hlintConfigWithFlags ["--ignore=Redundant id", "--hint=test-hlint-config.yaml"]- sendConfigurationChanged (toJSON config')+ setHlsConfig config' diags' <- waitForDiagnosticsFrom doc liftIO $ noHlintDiagnostics diags' , testCase "adding hlint flags to plugin configuration adds hlint diagnostics" $ runHlintSession "" $ do+ setIgnoringConfigurationRequests False enableHlint doc <- openDoc "Generalise.hs" "haskell"@@ -335,7 +338,7 @@ expectNoMoreDiagnostics 3 doc "hlint" let config' = hlintConfigWithFlags ["--with-group=generalise"]- sendConfigurationChanged (toJSON config')+ setHlsConfig config' diags' <- waitForDiagnosticsFromSource doc "hlint" d <- liftIO $ inspectDiagnostic diags' ["Use <>"]@@ -350,8 +353,7 @@ testDir = "test/testdata" runHlintSession :: FilePath -> Session a -> IO a-runHlintSession subdir =- failIfSessionTimeout . runSessionWithServerAndCaps hlintPlugin codeActionNoResolveCaps (testDir </> subdir)+runHlintSession subdir = failIfSessionTimeout . runSessionWithServerAndCaps def hlintPlugin codeActionNoResolveCaps (testDir </> subdir) noHlintDiagnostics :: [Diagnostic] -> Assertion noHlintDiagnostics diags =@@ -373,10 +375,10 @@ unObject _ = undefined enableHlint :: Session ()-enableHlint = sendConfigurationChanged $ toJSON $ def { Plugin.plugins = Map.fromList [ ("hlint", def { Plugin.plcGlobalOn = True }) ] }+enableHlint = setHlsConfig $ def { Plugin.plugins = Map.fromList [ ("hlint", def { Plugin.plcGlobalOn = True }) ] } disableHlint :: Session ()-disableHlint = sendConfigurationChanged $ toJSON $ def { Plugin.plugins = Map.fromList [ ("hlint", def { Plugin.plcGlobalOn = False }) ] }+disableHlint = setHlsConfig $ def { Plugin.plugins = Map.fromList [ ("hlint", def { Plugin.plcGlobalOn = False }) ] } -- We have two main code paths in the plugin depending on how hlint interacts with ghc: -- * One when hlint uses ghc-lib (all ghc versions but the last version supported by hlint)@@ -439,7 +441,7 @@ setupGoldenHlintTest :: TestName -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree setupGoldenHlintTest testName path =- goldenWithHaskellAndCaps codeActionNoResolveCaps hlintPlugin testName testDir path "expected" "hs"+ goldenWithHaskellAndCaps def codeActionNoResolveCaps hlintPlugin testName testDir path "expected" "hs" ignoreHintGoldenResolveTest :: TestName -> FilePath -> Point -> T.Text -> TestTree ignoreHintGoldenResolveTest testCaseName goldenFilename point hintName =@@ -460,4 +462,4 @@ setupGoldenHlintResolveTest :: TestName -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree setupGoldenHlintResolveTest testName path =- goldenWithHaskellAndCaps codeActionResolveCaps hlintPlugin testName testDir path "expected" "hs"+ goldenWithHaskellAndCaps def codeActionResolveCaps hlintPlugin testName testDir path "expected" "hs"