Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Wunused-packages in test utils #4004

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions hls-test-utils/hls-test-utils.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,15 @@ library
, aeson
, async
, base >=4.12 && <5
, blaze-markup
, bytestring
, containers
, data-default
, directory
, extra
, filepath
, ghcide == 2.6.0.0
, hls-graph
, hls-plugin-api == 2.6.0.0
, lens
, lsp ^>=2.3
, lsp-test ^>=0.16
, lsp-types ^>=2.1
, tasty
Expand All @@ -56,9 +53,8 @@ library
, tasty-rerun
, temporary
, text
, unordered-containers
, row-types
ghc-options: -Wall
ghc-options: -Wall -Wunused-packages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in a common section?

Copy link
Collaborator Author

@jhrcek jhrcek Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular package only has one component (library) and no tests etc. So I felt it's overkill to declare common warnings because it would only be imported in one place.


if flag(pedantic)
ghc-options: -Werror
Expand Down
25 changes: 12 additions & 13 deletions hls-test-utils/src/Test/Hls.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Test.Hls
( module Test.Tasty.HUnit,
module Test.Tasty,
Expand Down Expand Up @@ -440,12 +439,12 @@ runSessionWithServerInTmpDir' plugins conf sessConf caps tree act = withLock loc
| val /= "0" -> \action -> do
(tempDir, _) <- newTempDir
a <- action tempDir
logWith recorder Debug $ LogNoCleanup
logWith recorder Debug LogNoCleanup
pure a

_ -> \action -> do
a <- withTempDir action
logWith recorder Debug $ LogCleanup
logWith recorder Debug LogCleanup
pure a

runTestInDir $ \tmpDir -> do
Expand Down
20 changes: 10 additions & 10 deletions hls-test-utils/src/Test/Hls/Util.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
module Test.Hls.Util
( -- * Test Capabilities
codeActionResolveCaps
Expand Down Expand Up @@ -54,22 +54,22 @@ where

import Control.Applicative.Combinators (skipManyTill, (<|>))
import Control.Exception (catch, throwIO)
import Control.Lens ((&), (?~), (^.), _Just, (.~))
import Control.Lens (_Just, (&), (.~), (?~), (^.))
import Control.Monad
import Control.Monad.IO.Class
import qualified Data.Aeson as A
import Data.Bool (bool)
import Data.Default
import Data.Row
import Data.Proxy
import Data.List.Extra (find)
import Data.Proxy
import Data.Row
import qualified Data.Set as Set
import qualified Data.Text as T
import Development.IDE (GhcVersion (..), ghcVersion)
import qualified Language.LSP.Test as Test
import Language.LSP.Protocol.Types
import qualified Language.LSP.Protocol.Lens as L
import Language.LSP.Protocol.Message
import qualified Language.LSP.Protocol.Lens as L
import Language.LSP.Protocol.Types
import qualified Language.LSP.Test as Test
import System.Directory
import System.FilePath
import System.Info.Extra (isMac, isWindows)
Expand Down Expand Up @@ -304,7 +304,7 @@ waitForDiagnosticsFromSourceWithTimeout timeout document source = do
handleDiagnostic testId = do
diagsNot <- Test.message SMethod_TextDocumentPublishDiagnostics
let fileUri = diagsNot ^. L.params . L.uri
( diags) = diagsNot ^. L.params . L.diagnostics
diags = diagsNot ^. L.params . L.diagnostics
res = filter matches diags
if fileUri == document ^. L.uri && not (null res)
then return res else handleMessages testId
Expand Down
Loading