hls-retrie-plugin 1.0.1.4 → 1.0.2.0
raw patch · 2 files changed
+14/−25 lines, 2 filesdep +bytestringdep +stmdep ~ghcidedep ~hls-plugin-apiPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: bytestring, stm
Dependency ranges changed: ghcide, hls-plugin-api
API changes (from Hackage documentation)
- Ide.Plugin.Retrie: handleMaybe :: Monad m => e -> Maybe b -> ExceptT e m b
- Ide.Plugin.Retrie: handleMaybeM :: Monad m => e -> m (Maybe b) -> ExceptT e m b
- Ide.Plugin.Retrie: response :: Monad m => ExceptT String m a -> m (Either ResponseError a)
Files
- hls-retrie-plugin.cabal +5/−3
- src/Ide/Plugin/Retrie.hs +9/−22
hls-retrie-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hls-retrie-plugin-version: 1.0.1.4+version: 1.0.2.0 synopsis: Retrie integration plugin for Haskell Language Server description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -18,18 +18,20 @@ build-depends: , aeson , base >=4.12 && <5+ , bytestring , containers , deepseq , directory , extra , ghc- , ghcide ^>=1.5.0+ , ghcide ^>=1.6 , hashable- , hls-plugin-api >=1.1 && <1.3+ , hls-plugin-api ^>=1.3 , lsp , lsp-types , retrie >=0.1.1.0 , safe-exceptions+ , stm , text , transformers , unordered-containers
src/Ide/Plugin/Retrie.hs view
@@ -14,24 +14,25 @@ {-# OPTIONS -Wno-orphans #-} -module Ide.Plugin.Retrie (descriptor, response, handleMaybe, handleMaybeM) where+module Ide.Plugin.Retrie (descriptor) where import Control.Concurrent.Extra (readVar)+import Control.Concurrent.STM (readTVarIO) import Control.Exception.Safe (Exception (..), SomeException, catch, throwIO, try) import Control.Monad (forM, unless)-import Control.Monad.Extra (maybeM) import Control.Monad.IO.Class (MonadIO (liftIO)) import Control.Monad.Trans.Class (MonadTrans (lift))-import Control.Monad.Trans.Except (ExceptT (..), runExceptT,- throwE)+import Control.Monad.Trans.Except (ExceptT (ExceptT),+ runExceptT) import Control.Monad.Trans.Maybe import Data.Aeson (FromJSON (..), ToJSON (..), Value (Null), genericParseJSON) import qualified Data.Aeson as Aeson+import qualified Data.ByteString as BS import Data.Bifunctor (Bifunctor (first), second) import Data.Coerce@@ -44,7 +45,7 @@ import Data.List.Extra (find, nubOrdOn) import Data.String (IsString (fromString)) import qualified Data.Text as T-import qualified Data.Text.IO as T+import qualified Data.Text.Encoding as T import Data.Typeable (Typeable) import Development.IDE hiding (pluginHandlers) import Development.IDE.Core.PositionMapping@@ -357,7 +358,7 @@ Bool -> IO ([CallRetrieError], WorkspaceEdit) callRetrie state session rewrites origin restrictToOriginatingFile = do- knownFiles <- toKnownFiles . unhashed <$> readVar (knownTargetsVar $ shakeExtras state)+ knownFiles <- toKnownFiles . unhashed <$> readTVarIO (knownTargetsVar $ shakeExtras state) let reuseParsedModule f = do pm <- useOrFail "GetParsedModule" NoParse GetParsedModule f@@ -385,7 +386,7 @@ runAction "Retrie.GetFileContents" state $ getFileContents nt case mbContentsVFS of Just contents -> return contents- Nothing -> T.readFile (fromNormalizedFilePath nt)+ Nothing -> T.decodeUtf8 <$> BS.readFile (fromNormalizedFilePath nt) if any (T.isPrefixOf "#if" . T.toLower) (T.lines contents) then do fixitiesRef <- newIORef mempty@@ -500,20 +501,6 @@ useRule label = _useRuleStale ("Retrie." <> label) ---------------------------------------------------------------------------------- Error handling combinators--handleMaybe :: Monad m => e -> Maybe b -> ExceptT e m b-handleMaybe msg = maybe (throwE msg) return--handleMaybeM :: Monad m => e -> m (Maybe b) -> ExceptT e m b-handleMaybeM msg act = maybeM (throwE msg) return $ lift act--response :: Monad m => ExceptT String m a -> m (Either ResponseError a)-response =- fmap (first (\msg -> ResponseError InternalError (fromString msg) Nothing))- . runExceptT--------------------------------------------------------------------------------- -- Serialization wrappers and instances deriving instance Eq RewriteSpec@@ -529,7 +516,7 @@ data QualName = QualName {qual, name :: String} deriving (Eq, Show, Generic, FromJSON, ToJSON) -data IE name+newtype IE name = IEVar name deriving (Eq, Show, Generic, FromJSON, ToJSON)