Skip to content

Commit 1770989

Browse files
committed
Add warnings and fix them in hls-cabal-fmt-plugin
1 parent 767fc5b commit 1770989

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

plugins/hls-cabal-fmt-plugin/hls-cabal-fmt-plugin.cabal

+5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ category: Development
1414
build-type: Simple
1515
extra-source-files: LICENSE
1616

17+
common warnings
18+
ghc-options: -Wall
19+
1720
library
21+
import: warnings
1822
exposed-modules: Ide.Plugin.CabalFmt
1923
hs-source-dirs: src
2024
build-depends:
@@ -31,6 +35,7 @@ library
3135
default-language: Haskell2010
3236

3337
test-suite tests
38+
import: warnings
3439
type: exitcode-stdio-1.0
3540
default-language: Haskell2010
3641
hs-source-dirs: test

plugins/hls-cabal-fmt-plugin/src/Ide/Plugin/CabalFmt.hs

+4-12
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@ import CabalFmt
44
import CabalFmt.Error
55
import CabalFmt.Monad
66
import CabalFmt.Options
7-
import Control.Exception (bracket_)
87
import Control.Monad.IO.Class
9-
import Control.Monad.Trans.Maybe (MaybeT, runMaybeT)
10-
import Data.Maybe (mapMaybe, maybeToList)
11-
import Data.Semigroup
12-
import Data.Text (Text)
13-
import qualified Data.Text as T
8+
import qualified Data.Text as T
149
import Data.Text.Encoding
15-
import Development.IDE hiding (pluginHandlers)
16-
import Development.IDE.GHC.Compat (ModSummary (ms_hspp_opts), topDir)
10+
import Development.IDE hiding (pluginHandlers)
1711
import Ide.PluginUtils
1812
import Ide.Types
19-
import Language.LSP.Types as J
20-
import qualified Language.LSP.Types.Lens as J
21-
import System.Environment (setEnv, unsetEnv)
13+
import Language.LSP.Types as J
2214
import System.FilePath
2315

2416
descriptor :: PluginId -> PluginDescriptor IdeState
@@ -30,7 +22,7 @@ descriptor plId = (defaultCabalPluginDescriptor plId)
3022
-- Formats the given source in either a given Range or the whole Document.
3123
-- If the provider fails an error is returned that can be displayed to the user.
3224
provider :: FormattingHandler IdeState
33-
provider ide typ contents nfp opts = liftIO $ do
25+
provider _ide _typ contents nfp opts = liftIO $ do
3426
cabalFmtOutput <- runCabalFmtIO (Just $ takeDirectory fp) cabalFmtOpts (cabalFmt fp (encodeUtf8 contents))
3527
case cabalFmtOutput of
3628
Left err -> pure $ Left (cabalErrToRespErr err)

0 commit comments

Comments
 (0)