packages feed

hls-plugin-api 1.3.0.0 → 1.4.0.0

raw patch · 4 files changed

+21/−39 lines, 4 filesdep −hsloggerdep ~dependent-sumdep ~hls-graphdep ~lspnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependencies removed: hslogger

Dependency ranges changed: dependent-sum, hls-graph, lsp, opentelemetry

API changes (from Hackage documentation)

- Ide.Logger: debugm :: MonadIO m => String -> m ()
- Ide.Logger: errorm :: MonadIO m => String -> m ()
- Ide.Logger: logm :: MonadIO m => String -> m ()
- Ide.Logger: warningm :: MonadIO m => String -> m ()
+ Ide.PluginUtils: getNormalizedFilePath :: Monad m => PluginId -> TextDocumentIdentifier -> ExceptT String m NormalizedFilePath
- Ide.Types: PluginNotificationHandler :: (PluginId -> a -> MessageParams m -> LspM Config ()) -> PluginNotificationHandler a (m :: Method FromClient Notification)
+ Ide.Types: PluginNotificationHandler :: (PluginId -> a -> VFS -> MessageParams m -> LspM Config ()) -> PluginNotificationHandler a (m :: Method FromClient Notification)
- Ide.Types: type PluginNotificationMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config ()
+ Ide.Types: type PluginNotificationMethodHandler a m = a -> VFS -> PluginId -> MessageParams m -> LspM Config ()

Files

hls-plugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name:          hls-plugin-api-version:       1.3.0.0+version:       1.4.0.0 synopsis:      Haskell Language Server API for plugin communication description:   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -26,7 +26,6 @@  library   exposed-modules:-    Ide.Logger     Ide.Plugin.Config     Ide.Plugin.ConfigUtils     Ide.Plugin.Properties@@ -46,11 +45,10 @@     , extra     , ghc     , hashable-    , hls-graph             ^>= 1.6-    , hslogger+    , hls-graph             ^>= 1.7     , lens     , lens-aeson-    , lsp                   ^>=1.4.0.0+    , lsp                   >=1.4.0.0 && < 1.6     , opentelemetry     , optparse-applicative     , process
− src/Ide/Logger.hs
@@ -1,29 +0,0 @@-{- | Provides an implementation of the ghcide @Logger@ which uses-   @System.Log.Logger@ under the hood.--}-module Ide.Logger-  (-    logm-  , debugm-  , warningm-  , errorm-  ) where--import           Control.Monad.IO.Class-import           System.Log.Logger---- -----------------------------------------------------------------------logm :: MonadIO m => String -> m ()-logm s = liftIO $ infoM "hls" s--debugm :: MonadIO m => String -> m ()-debugm s = liftIO $ debugM "hls" s--warningm :: MonadIO m => String -> m ()-warningm s = liftIO $ warningM "hls" s--errorm :: MonadIO m => String -> m ()-errorm s = liftIO $ errorM "hls" s---- ---------------------------------------------------------------------
src/Ide/PluginUtils.hs view
@@ -27,6 +27,7 @@     subRange,     positionInRange,     usePropertyLsp,+    getNormalizedFilePath,     response,     handleMaybe,     handleMaybeM,@@ -34,6 +35,7 @@ where  +import           Control.Lens                    ((^.)) import           Control.Monad.Extra             (maybeM) import           Control.Monad.Trans.Class       (lift) import           Control.Monad.Trans.Except      (ExceptT, runExceptT, throwE)@@ -54,6 +56,7 @@                                                   SemanticTokensEdit (_start)) import qualified Language.LSP.Types              as J import           Language.LSP.Types.Capabilities+import           Language.LSP.Types.Lens         (uri)  -- --------------------------------------------------------------------- @@ -243,6 +246,15 @@  -- --------------------------------------------------------------------- +getNormalizedFilePath :: Monad m => PluginId -> TextDocumentIdentifier -> ExceptT String m NormalizedFilePath+getNormalizedFilePath (PluginId plId) docId = handleMaybe errMsg+        $ uriToNormalizedFilePath+        $ toNormalizedUri uri'+    where+        errMsg = T.unpack $ "Error(" <> plId <> "): converting " <> getUri uri' <> " to NormalizedFilePath"+        uri' = docId ^. uri++-- --------------------------------------------------------------------- handleMaybe :: Monad m => e -> Maybe b -> ExceptT e m b handleMaybe msg = maybe (throwE msg) return 
src/Ide/Types.hs view
@@ -315,7 +315,7 @@   = PluginHandler (PluginId -> a -> MessageParams m -> LspM Config (NonEmpty (Either ResponseError (ResponseResult m))))  newtype PluginNotificationHandler a (m :: Method FromClient Notification)-  = PluginNotificationHandler (PluginId -> a -> MessageParams m -> LspM Config ())+  = PluginNotificationHandler (PluginId -> a -> VFS -> MessageParams m -> LspM Config ())  newtype PluginHandlers a             = PluginHandlers             (DMap IdeMethod       (PluginHandler a)) newtype PluginNotificationHandlers a = PluginNotificationHandlers (DMap IdeNotification (PluginNotificationHandler a))@@ -331,15 +331,15 @@ instance Semigroup (PluginNotificationHandlers a) where   (PluginNotificationHandlers a) <> (PluginNotificationHandlers b) = PluginNotificationHandlers $ DMap.unionWithKey go a b     where-      go _ (PluginNotificationHandler f) (PluginNotificationHandler g) = PluginNotificationHandler $ \pid ide params ->-        f pid ide params >> g pid ide params+      go _ (PluginNotificationHandler f) (PluginNotificationHandler g) = PluginNotificationHandler $ \pid ide vfs params ->+        f pid ide vfs params >> g pid ide vfs params  instance Monoid (PluginNotificationHandlers a) where   mempty = PluginNotificationHandlers mempty  type PluginMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m)) -type PluginNotificationMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config ()+type PluginNotificationMethodHandler a m = a -> VFS -> PluginId -> MessageParams m -> LspM Config ()  -- | Make a handler for plugins with no extra data mkPluginHandler@@ -360,7 +360,7 @@ mkPluginNotificationHandler m f     = PluginNotificationHandlers $ DMap.singleton (IdeNotification m) (PluginNotificationHandler f')   where-    f' pid ide = f ide pid+    f' pid ide vfs = f ide vfs pid  defaultPluginDescriptor :: PluginId -> PluginDescriptor ideState defaultPluginDescriptor plId =@@ -396,6 +396,7 @@  newtype PluginId = PluginId T.Text   deriving (Show, Read, Eq, Ord)+ instance IsString PluginId where   fromString = PluginId . T.pack