hls-floskell-plugin 2.0.0.1 → 2.1.0.0
raw patch · 2 files changed
+18/−15 lines, 2 filesdep +mtldep ~ghcidedep ~hls-plugin-apidep ~hls-test-utilsPVP ok
version bump matches the API change (PVP)
Dependencies added: mtl
Dependency ranges changed: ghcide, hls-plugin-api, hls-test-utils, lsp-types
API changes (from Hackage documentation)
Files
- hls-floskell-plugin.cabal +6/−5
- src/Ide/Plugin/Floskell.hs +12/−10
hls-floskell-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-floskell-plugin-version: 2.0.0.1+version: 2.1.0.0 synopsis: Integration with the Floskell code formatter description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -28,9 +28,10 @@ build-depends: , base >=4.12 && <5 , floskell ^>=0.10- , ghcide == 2.0.0.1- , hls-plugin-api == 2.0.0.1- , lsp-types ^>=1.6+ , ghcide == 2.1.0.0+ , hls-plugin-api == 2.1.0.0+ , lsp-types ^>=2.0.1.0+ , mtl , text , transformers @@ -48,4 +49,4 @@ , base , filepath , hls-floskell-plugin- , hls-test-utils == 2.0.0.1+ , hls-test-utils == 2.1.0.0
src/Ide/Plugin/Floskell.hs view
@@ -5,15 +5,17 @@ , provider ) where +import Control.Monad.Except (throwError) 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 hiding (pluginHandlers)+import qualified Data.Text as T+import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TL+import Development.IDE hiding (pluginHandlers) import Floskell+import Ide.Plugin.Error import Ide.PluginUtils import Ide.Types-import Language.LSP.Types+import Language.LSP.Protocol.Types -- --------------------------------------------------------------------- @@ -28,16 +30,16 @@ -- Formats the given source in either a given Range or the whole Document. -- If the provider fails an error is returned that can be displayed to the user. provider :: FormattingHandler IdeState-provider _ideState typ contents fp _ = liftIO $ do+provider _ideState typ contents fp _ = do let file = fromNormalizedFilePath fp- config <- findConfigOrDefault file+ config <- liftIO $ findConfigOrDefault file let (range, selectedContents) = case typ of FormatText -> (fullRange contents, contents)- FormatRange r -> (normalize r, extractRange r contents)+ FormatRange r -> (normalize r, extractTextInRange (extendToFullLines r) contents) result = reformat config (Just file) . TL.encodeUtf8 $ TL.fromStrict selectedContents case result of- Left err -> pure $ Left $ responseError $ T.pack $ "floskellCmd: " ++ err- Right new -> pure $ Right $ List [TextEdit range . TL.toStrict $ TL.decodeUtf8 new]+ Left err -> throwError $ PluginInternalError $ T.pack $ "floskellCmd: " ++ err+ Right new -> pure $ InL [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.