hls-plugin-api 1.1.0.1 → 1.1.0.2
raw patch · 4 files changed
+33/−4 lines, 4 filesdep +ghcdep +ghc-api-compatdep ~hls-graphdep ~lspPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: ghc, ghc-api-compat
Dependency ranges changed: hls-graph, lsp
API changes (from Hackage documentation)
+ Ide.Types: DynFlagsModifications :: (DynFlags -> DynFlags) -> (DynFlags -> DynFlags) -> DynFlagsModifications
+ Ide.Types: [dynFlagsModifyGlobal] :: DynFlagsModifications -> DynFlags -> DynFlags
+ Ide.Types: [dynFlagsModifyParser] :: DynFlagsModifications -> DynFlags -> DynFlags
+ Ide.Types: [pluginModifyDynflags] :: PluginDescriptor ideState -> DynFlagsModifications
+ Ide.Types: data DynFlagsModifications
+ Ide.Types: instance GHC.Base.Monoid Ide.Types.DynFlagsModifications
+ Ide.Types: instance GHC.Base.Semigroup Ide.Types.DynFlagsModifications
- Ide.Types: PluginDescriptor :: !PluginId -> !Rules () -> ![PluginCommand ideState] -> PluginHandlers ideState -> ConfigDescriptor -> PluginNotificationHandlers ideState -> PluginDescriptor ideState
+ Ide.Types: PluginDescriptor :: !PluginId -> !Rules () -> ![PluginCommand ideState] -> PluginHandlers ideState -> ConfigDescriptor -> PluginNotificationHandlers ideState -> DynFlagsModifications -> PluginDescriptor ideState
Files
- hls-plugin-api.cabal +4/−2
- src/Ide/Plugin/ConfigUtils.hs +1/−1
- src/Ide/Plugin/Properties.hs +1/−1
- src/Ide/Types.hs +27/−0
hls-plugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-plugin-api-version: 1.1.0.1+version: 1.1.0.2 synopsis: Haskell Language Server API for plugin communication description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -43,6 +43,8 @@ , dependent-sum , Diff ^>=0.4.0 , dlist+ , ghc+ , ghc-api-compat , hashable , hslogger , lens@@ -50,7 +52,7 @@ , opentelemetry , process , regex-tdfa >=1.3.1.0- , hls-graph ^>=1.3+ , hls-graph ^>=1.4 , text , unordered-containers
src/Ide/Plugin/ConfigUtils.hs view
@@ -22,7 +22,7 @@ -- since diagnostics emit in arbitrary shake rules -- we don't know -- whether a plugin is capable of producing diagnostics. --- | Generates a defalut 'Config', but remains only effective items+-- | Generates a default 'Config', but remains only effective items pluginsToDefaultConfig :: IdePlugins a -> A.Value pluginsToDefaultConfig IdePlugins {..} = A.Object $
src/Ide/Plugin/Properties.hs view
@@ -48,7 +48,7 @@ import Data.Function ((&)) import Data.Kind (Constraint, Type) import qualified Data.Map.Strict as Map-import Data.Proxy (Proxy (..))+import Data.Proxy (Proxy (..)) import qualified Data.Text as T import GHC.OverloadedLabels (IsLabel (..)) import GHC.TypeLits
src/Ide/Types.hs view
@@ -39,6 +39,7 @@ import qualified Data.Text as T import Data.Text.Encoding (encodeUtf8) import Development.IDE.Graph+import DynFlags (DynFlags) import GHC.Generics import Ide.Plugin.Config import Ide.Plugin.Properties@@ -56,6 +57,30 @@ newtype IdePlugins ideState = IdePlugins { ipMap :: [(PluginId, PluginDescriptor ideState)]} +-- | Hooks for modifying the 'DynFlags' at different times of the compilation+-- process. Plugins can install a 'DynFlagsModifications' via+-- 'pluginModifyDynflags' in their 'PluginDescriptor'.+data DynFlagsModifications =+ DynFlagsModifications+ { -- | Invoked immediately at the package level. Changes to the 'DynFlags'+ -- made in 'dynFlagsModifyGlobal' are guaranteed to be seen everywhere in+ -- the compilation pipeline.+ dynFlagsModifyGlobal :: DynFlags -> DynFlags+ -- | Invoked just before the parsing step, and reset immediately+ -- afterwards. 'dynFlagsModifyParser' allows plugins to enable language+ -- extensions only during parsing. for example, to let them enable+ -- certain pieces of syntax.+ , dynFlagsModifyParser :: DynFlags -> DynFlags+ }++instance Semigroup DynFlagsModifications where+ DynFlagsModifications g1 p1 <> DynFlagsModifications g2 p2 =+ DynFlagsModifications (g2 . g1) (p2 . p1)++instance Monoid DynFlagsModifications where+ mempty = DynFlagsModifications id id++ -- --------------------------------------------------------------------- data PluginDescriptor ideState =@@ -65,6 +90,7 @@ , pluginHandlers :: PluginHandlers ideState , pluginConfigDescriptor :: ConfigDescriptor , pluginNotificationHandlers :: PluginNotificationHandlers ideState+ , pluginModifyDynflags :: DynFlagsModifications } -- | An existential wrapper of 'Properties'@@ -296,6 +322,7 @@ mempty mempty defaultConfigDescriptor+ mempty mempty newtype CommandId = CommandId T.Text