packages feed

hls-floskell-plugin 1.0.0.0 → 1.0.0.1

raw patch · 3 files changed

+31/−31 lines, 3 filesdep +filepathdep ~hls-plugin-apidep ~hls-test-utilsnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependencies added: filepath

Dependency ranges changed: hls-plugin-api, hls-test-utils

API changes (from Hackage documentation)

Files

hls-floskell-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               hls-floskell-plugin-version:            1.0.0.0+version:            1.0.0.1 synopsis:           Integration with the Floskell code formatter description:   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -20,10 +20,10 @@   exposed-modules:  Ide.Plugin.Floskell   hs-source-dirs:   src   build-depends:-    , base            >=4.12     && <5-    , floskell       ^>=0.10-    , ghcide           >=1.2 && <1.4-    , hls-plugin-api  ^>=1.1+    , base            >=4.12 && <5+    , floskell        ^>=0.10+    , ghcide          >=1.2  && <1.5+    , hls-plugin-api  >=1.1  && <1.3     , lsp-types     , text     , transformers@@ -38,6 +38,6 @@   ghc-options:      -threaded -rtsopts -with-rtsopts=-N   build-depends:     , base+    , filepath     , hls-floskell-plugin-    , hls-test-utils       ^>=1.0-    , text+    , hls-test-utils       >=1.0 && <1.2
src/Ide/Plugin/Floskell.hs view
@@ -1,18 +1,15 @@-{-# LANGUAGE OverloadedStrings   #-}-{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE OverloadedStrings #-}  module Ide.Plugin.Floskell-  (-    descriptor+  ( descriptor   , provider-  )-where+  ) where  import           Control.Monad.IO.Class import qualified Data.Text               as T import qualified Data.Text.Lazy          as TL import qualified Data.Text.Lazy.Encoding as TL-import           Development.IDE         as D hiding (pluginHandlers)+import           Development.IDE         hiding (pluginHandlers) import           Floskell import           Ide.PluginUtils import           Ide.Types@@ -37,10 +34,10 @@     let (range, selectedContents) = case typ of           FormatText    -> (fullRange contents, contents)           FormatRange r -> (r, extractRange r contents)-        result = reformat config (Just file) (TL.encodeUtf8 (TL.fromStrict selectedContents))+        result = reformat config (Just file) . TL.encodeUtf8 $ TL.fromStrict selectedContents     case result of-      Left  err -> return $ Left $ responseError (T.pack $  "floskellCmd: " ++ err)-      Right new -> return $ Right $ List [TextEdit range . TL.toStrict $ TL.decodeUtf8 new]+      Left  err -> pure $ Left $ responseError $ T.pack $ "floskellCmd: " ++ err+      Right new -> pure $ Right $ List [TextEdit range . TL.toStrict $ TL.decodeUtf8 new]  -- | Find Floskell Config, user and system wide or provides a default style. -- Every directory of the filepath will be searched to find a user configuration.@@ -53,6 +50,6 @@     Just confFile -> readAppConfig confFile     Nothing ->       let gibiansky = head (filter (\s -> styleName s == "gibiansky") styles)-      in return $ defaultAppConfig { appStyle = gibiansky }+      in pure $ defaultAppConfig { appStyle = gibiansky }  -- ---------------------------------------------------------------------
test/Main.hs view
@@ -1,27 +1,30 @@ {-# LANGUAGE OverloadedStrings #-}-module Main(main) where+module Main+  ( main+  ) where -import qualified Data.Text.Lazy          as TL-import qualified Data.Text.Lazy.Encoding as TL-import qualified Ide.Plugin.Floskell     as Floskell+import qualified Ide.Plugin.Floskell as Floskell+import           System.FilePath import           Test.Hls  main :: IO () main = defaultTestRunner tests -plugin :: PluginDescriptor IdeState-plugin = Floskell.descriptor "floskell"+floskellPlugin :: PluginDescriptor IdeState+floskellPlugin = Floskell.descriptor "floskell"  tests :: TestTree tests = testGroup "floskell"-  [ goldenGitDiff "formats a document" "test/testdata/Floskell.formatted_document.hs" $ runSessionWithServerFormatter plugin "floskell" "test/testdata" $ do-        doc <- openDoc "Floskell.hs" "haskell"-        formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing)-        TL.encodeUtf8 . TL.fromStrict <$> documentContents doc+  [ goldenWithFloskell "formats a document" "Floskell" "formatted_document" $ \doc -> do+      formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing) -  , goldenGitDiff "formats a range" "test/testdata/Floskell.formatted_range.hs" $ runSessionWithServerFormatter plugin "floskell" "test/testdata" $ do-      doc <- openDoc "Floskell.hs" "haskell"+  , goldenWithFloskell "formats a range" "Floskell" "formatted_range" $ \doc -> do       let range = Range (Position 1 0) (Position 4 22)       formatRange doc (FormattingOptions 4 True Nothing Nothing Nothing) range-      TL.encodeUtf8 . TL.fromStrict <$> documentContents doc   ]++goldenWithFloskell :: TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree+goldenWithFloskell title path desc = goldenWithHaskellDocFormatter floskellPlugin "floskell" title testDataDir path desc "hs"++testDataDir :: FilePath+testDataDir = "test" </> "testdata"