-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell Language Server API for plugin communication -- -- Please see the README on GitHub at -- https://github.com/haskell/haskell-language-server#readme @package hls-plugin-api @version 1.2.0.2 -- | Provides an implementation of the ghcide Logger which uses -- System.Log.Logger under the hood. module Ide.Logger logm :: MonadIO m => String -> m () debugm :: MonadIO m => String -> m () warningm :: MonadIO m => String -> m () errorm :: MonadIO m => String -> m () module Ide.Plugin.Config -- | Given a DidChangeConfigurationNotification message, this function -- returns the parsed Config object if possible. getConfigFromNotification :: Config -> Value -> Either Text Config -- | We (initially anyway) mirror the hie configuration, so that existing -- clients can simply switch executable and not have any nasty surprises. -- There will be surprises relating to config options being ignored, -- initially though. data Config Config :: CheckParents -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Text -> !Int -> !Map Text PluginConfig -> Config [checkParents] :: Config -> CheckParents [checkProject] :: Config -> !Bool [hlintOn] :: Config -> !Bool [diagnosticsOnChange] :: Config -> !Bool [liquidOn] :: Config -> !Bool [formatOnImportOn] :: Config -> !Bool [formattingProvider] :: Config -> !Text [maxCompletions] :: Config -> !Int [plugins] :: Config -> !Map Text PluginConfig parseConfig :: Config -> Value -> Parser Config -- | A PluginConfig is a generic configuration for a given HLS plugin. It -- provides a "big switch" to turn it on or off as a whole, as well as -- small switches per feature, and a slot for custom config. This -- provides a regular naming scheme for all plugin config. data PluginConfig PluginConfig :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Object -> PluginConfig [plcGlobalOn] :: PluginConfig -> !Bool [plcCallHierarchyOn] :: PluginConfig -> !Bool [plcCodeActionsOn] :: PluginConfig -> !Bool [plcCodeLensOn] :: PluginConfig -> !Bool [plcDiagnosticsOn] :: PluginConfig -> !Bool [plcHoverOn] :: PluginConfig -> !Bool [plcSymbolsOn] :: PluginConfig -> !Bool [plcCompletionOn] :: PluginConfig -> !Bool [plcRenameOn] :: PluginConfig -> !Bool [plcConfig] :: PluginConfig -> !Object data CheckParents NeverCheck :: CheckParents CheckOnSave :: CheckParents AlwaysCheck :: CheckParents instance Data.Aeson.Types.ToJSON.ToJSON Ide.Plugin.Config.CheckParents instance Data.Aeson.Types.FromJSON.FromJSON Ide.Plugin.Config.CheckParents instance GHC.Generics.Generic Ide.Plugin.Config.CheckParents instance GHC.Show.Show Ide.Plugin.Config.CheckParents instance GHC.Classes.Ord Ide.Plugin.Config.CheckParents instance GHC.Classes.Eq Ide.Plugin.Config.CheckParents instance GHC.Classes.Eq Ide.Plugin.Config.PluginConfig instance GHC.Show.Show Ide.Plugin.Config.PluginConfig instance GHC.Classes.Eq Ide.Plugin.Config.Config instance GHC.Show.Show Ide.Plugin.Config.Config instance Data.Default.Class.Default Ide.Plugin.Config.Config instance Data.Aeson.Types.ToJSON.ToJSON Ide.Plugin.Config.Config instance Data.Default.Class.Default Ide.Plugin.Config.PluginConfig instance Data.Aeson.Types.ToJSON.ToJSON Ide.Plugin.Config.PluginConfig instance Data.Aeson.Types.FromJSON.FromJSON Ide.Plugin.Config.PluginConfig module Ide.Plugin.Properties -- | Types properties may have data PropertyType TNumber :: PropertyType TInteger :: PropertyType TString :: PropertyType TBoolean :: PropertyType TObject :: Type -> PropertyType TArray :: Type -> PropertyType TEnum :: Type -> PropertyType type family ToHsType (t :: PropertyType) -- | Metadata of a property data MetaData (t :: PropertyType) [MetaData] :: IsTEnum t ~ 'False => {defaultValue :: ToHsType t, description :: Text} -> MetaData t [EnumMetaData] :: IsTEnum t ~ 'True => {defaultValue :: ToHsType t, description :: Text, enumValues :: [ToHsType t], enumDescriptions :: [Text]} -> MetaData t -- | Used at type level for name-type mapping in Properties data PropertyKey PropertyKey :: Symbol -> PropertyType -> PropertyKey -- | Singleton type of PropertyKey data SPropertyKey (k :: PropertyKey) [SNumber] :: SPropertyKey ('PropertyKey s 'TNumber) [SInteger] :: SPropertyKey ('PropertyKey s 'TInteger) [SString] :: SPropertyKey ('PropertyKey s 'TString) [SBoolean] :: SPropertyKey ('PropertyKey s 'TBoolean) [SObject] :: (ToJSON a, FromJSON a) => Proxy a -> SPropertyKey ('PropertyKey s ('TObject a)) [SArray] :: (ToJSON a, FromJSON a) => Proxy a -> SPropertyKey ('PropertyKey s ('TArray a)) [SEnum] :: (ToJSON a, FromJSON a, Eq a, Show a) => Proxy a -> SPropertyKey ('PropertyKey s ('TEnum a)) -- | A proxy type in order to allow overloaded labels as properties' names -- at the call site data KeyNameProxy (s :: Symbol) KeyNameProxy :: KeyNameProxy (s :: Symbol) -- | Properties is a partial implementation of json schema, without -- supporting union types and validation. In hls, it defines a set of -- properties which used in dedicated configuration of a plugin. A -- property is an immediate child of the json object in each plugin's -- "config" section. It was designed to be compatible with vscode's -- settings UI. Use emptyProperties and useProperty to -- create and consume Properties. data Properties (r :: [PropertyKey]) -- | In row r, there is a PropertyKey k, which has -- name s and carries haskell type t type HasProperty s k t r = (k ~ 'PropertyKey s t, Elem s r, FindByKeyName s r ~ t, KnownSymbol s) -- | Creates a Properties that defines no property -- -- Useful to start a definitions chain, for example: properties = -- emptyProperties & defineStringProperty #exampleString "Description -- of exampleString" Foo & defineNumberProperty #exampleNumber -- "Description of exampleNumber" 233 emptyProperties :: Properties '[] -- | Defines a number property defineNumberProperty :: (KnownSymbol s, NotElem s r) => KeyNameProxy s -> Text -> Double -> Properties r -> Properties ('PropertyKey s 'TNumber : r) -- | Defines an integer property defineIntegerProperty :: (KnownSymbol s, NotElem s r) => KeyNameProxy s -> Text -> Int -> Properties r -> Properties ('PropertyKey s 'TInteger : r) -- | Defines a string property defineStringProperty :: (KnownSymbol s, NotElem s r) => KeyNameProxy s -> Text -> Text -> Properties r -> Properties ('PropertyKey s 'TString : r) -- | Defines a boolean property defineBooleanProperty :: (KnownSymbol s, NotElem s r) => KeyNameProxy s -> Text -> Bool -> Properties r -> Properties ('PropertyKey s 'TBoolean : r) -- | Defines an object property defineObjectProperty :: (KnownSymbol s, NotElem s r, ToJSON a, FromJSON a) => KeyNameProxy s -> Text -> a -> Properties r -> Properties ('PropertyKey s ('TObject a) : r) -- | Defines an array property defineArrayProperty :: (KnownSymbol s, NotElem s r, ToJSON a, FromJSON a) => KeyNameProxy s -> Text -> [a] -> Properties r -> Properties ('PropertyKey s ('TArray a) : r) -- | Defines an enum property defineEnumProperty :: (KnownSymbol s, NotElem s r, ToJSON a, FromJSON a, Eq a, Show a) => KeyNameProxy s -> Text -> [(a, Text)] -> a -> Properties r -> Properties ('PropertyKey s ('TEnum a) : r) -- | Converts a properties definition into kv pairs with default values -- from MetaData toDefaultJSON :: Properties r -> [Pair] -- | Converts a properties definition into kv pairs as vscode schema toVSCodeExtensionSchema :: Text -> Properties r -> [Pair] -- | Given the name of a defined property, generates a JSON parser of -- plcConfig usePropertyEither :: HasProperty s k t r => KeyNameProxy s -> Properties r -> Object -> Either String (ToHsType t) -- | Like usePropertyEither but returns defaultValue on parse -- error useProperty :: HasProperty s k t r => KeyNameProxy s -> Properties r -> Object -> ToHsType t -- | & is a reverse application operator. This provides -- notational convenience. Its precedence is one higher than that of the -- forward application operator $, which allows & to be -- nested in $. -- --
--   >>> 5 & (+1) & show
--   "6"
--   
(&) :: a -> (a -> b) -> b infixl 1 & instance (GHC.TypeLits.KnownSymbol s', s GHC.Types.~ s') => GHC.OverloadedLabels.IsLabel s (Ide.Plugin.Properties.KeyNameProxy s') module Ide.Types newtype IdePlugins ideState IdePlugins :: [(PluginId, PluginDescriptor ideState)] -> IdePlugins ideState [ipMap] :: IdePlugins ideState -> [(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 :: (DynFlags -> DynFlags) -> (DynFlags -> DynFlags) -> 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] :: DynFlagsModifications -> 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] :: DynFlagsModifications -> DynFlags -> DynFlags newtype IdeCommand state IdeCommand :: (state -> IO ()) -> IdeCommand state data PluginDescriptor ideState PluginDescriptor :: !PluginId -> !Rules () -> ![PluginCommand ideState] -> PluginHandlers ideState -> ConfigDescriptor -> PluginNotificationHandlers ideState -> DynFlagsModifications -> Maybe (ParserInfo (IdeCommand ideState)) -> PluginDescriptor ideState [pluginId] :: PluginDescriptor ideState -> !PluginId [pluginRules] :: PluginDescriptor ideState -> !Rules () [pluginCommands] :: PluginDescriptor ideState -> ![PluginCommand ideState] [pluginHandlers] :: PluginDescriptor ideState -> PluginHandlers ideState [pluginConfigDescriptor] :: PluginDescriptor ideState -> ConfigDescriptor [pluginNotificationHandlers] :: PluginDescriptor ideState -> PluginNotificationHandlers ideState [pluginModifyDynflags] :: PluginDescriptor ideState -> DynFlagsModifications [pluginCli] :: PluginDescriptor ideState -> Maybe (ParserInfo (IdeCommand ideState)) -- | An existential wrapper of Properties data CustomConfig CustomConfig :: Properties r -> CustomConfig -- | Describes the configuration a plugin. A plugin may be configurable in -- such form: { "plugin-id": { "globalOn": true, "codeActionsOn": -- true, "codeLensOn": true, "config": { "property1": "foo" } } } -- globalOn, codeActionsOn, and codeLensOn -- etc. are called generic configs, which can be inferred from handlers -- registered by the plugin. config is called custom config, -- which is defined using Properties. data ConfigDescriptor ConfigDescriptor :: Bool -> Bool -> CustomConfig -> ConfigDescriptor -- | Whether or not to generate generic configs. [configEnableGenericConfig] :: ConfigDescriptor -> Bool -- | Whether or not to generate diagnosticsOn config. Diagnostics -- emit in arbitrary shake rules, so we can't know statically if the -- plugin produces diagnostics [configHasDiagnostics] :: ConfigDescriptor -> Bool -- | Custom config. [configCustomConfig] :: ConfigDescriptor -> CustomConfig mkCustomConfig :: Properties r -> CustomConfig defaultConfigDescriptor :: ConfigDescriptor -- | Methods that can be handled by plugins. ExtraParams captures -- any extra data the IDE passes to the handlers for this method Only -- methods for which we know how to combine responses can be instances of -- PluginMethod class HasTracing (MessageParams m) => PluginMethod m -- | Parse the configuration to check if this plugin is enabled pluginEnabled :: PluginMethod m => SMethod m -> PluginId -> Config -> Bool -- | How to combine responses from different plugins combineResponses :: PluginMethod m => SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (ResponseResult m) -> ResponseResult m -- | How to combine responses from different plugins combineResponses :: (PluginMethod m, Semigroup (ResponseResult m)) => SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (ResponseResult m) -> ResponseResult m -- | Methods which have a PluginMethod instance data IdeMethod (m :: Method FromClient Request) IdeMethod :: SMethod m -> IdeMethod (m :: Method FromClient Request) -- | Methods which have a PluginMethod instance data IdeNotification (m :: Method FromClient Notification) IdeNotification :: SMethod m -> IdeNotification (m :: Method FromClient Notification) -- | Combine handlers for the newtype PluginHandler a (m :: Method FromClient Request) PluginHandler :: (PluginId -> a -> MessageParams m -> LspM Config (NonEmpty (Either ResponseError (ResponseResult m)))) -> PluginHandler a (m :: Method FromClient Request) newtype PluginNotificationHandler a (m :: Method FromClient Notification) PluginNotificationHandler :: (PluginId -> a -> MessageParams m -> LspM Config ()) -> PluginNotificationHandler a (m :: Method FromClient Notification) newtype PluginHandlers a PluginHandlers :: DMap IdeMethod (PluginHandler a) -> PluginHandlers a newtype PluginNotificationHandlers a PluginNotificationHandlers :: DMap IdeNotification (PluginNotificationHandler a) -> PluginNotificationHandlers a type PluginMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m)) type PluginNotificationMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config () -- | Make a handler for plugins with no extra data mkPluginHandler :: PluginMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState -- | Make a handler for plugins with no extra data mkPluginNotificationHandler :: HasTracing (MessageParams m) => SClientMethod (m :: Method FromClient Notification) -> PluginNotificationMethodHandler ideState m -> PluginNotificationHandlers ideState defaultPluginDescriptor :: PluginId -> PluginDescriptor ideState newtype CommandId CommandId :: Text -> CommandId data PluginCommand ideState PluginCommand :: CommandId -> Text -> CommandFunction ideState a -> PluginCommand ideState [commandId] :: PluginCommand ideState -> CommandId [commandDesc] :: PluginCommand ideState -> Text [commandFunc] :: PluginCommand ideState -> CommandFunction ideState a type CommandFunction ideState a = ideState -> a -> LspM Config (Either ResponseError Value) newtype PluginId PluginId :: Text -> PluginId configForPlugin :: Config -> PluginId -> PluginConfig -- | Checks that a given plugin is both enabled and the specific feature is -- enabled pluginEnabledConfig :: (PluginConfig -> Bool) -> PluginId -> Config -> Bool -- | Format the given Text as a whole or only a Range of it. Range -- must be relative to the text to format. To format the whole document, -- read the Text from the file and use FormatText as the -- FormattingType. data FormattingType FormatText :: FormattingType FormatRange :: Range -> FormattingType type FormattingMethod m = (HasOptions (MessageParams m) FormattingOptions, HasTextDocument (MessageParams m) TextDocumentIdentifier, ResponseResult m ~ List TextEdit) type FormattingHandler a = a -> FormattingType -> Text -> NormalizedFilePath -> FormattingOptions -> LspM Config (Either ResponseError (List TextEdit)) mkFormattingHandlers :: forall a. FormattingHandler a -> PluginHandlers a responseError :: Text -> ResponseError data FallbackCodeActionParams FallbackCodeActionParams :: Maybe WorkspaceEdit -> Maybe Command -> FallbackCodeActionParams [fallbackWorkspaceEdit] :: FallbackCodeActionParams -> Maybe WorkspaceEdit [fallbackCommand] :: FallbackCodeActionParams -> Maybe Command otSetUri :: SpanInFlight -> Uri -> IO () class HasTracing a traceWithSpan :: HasTracing a => SpanInFlight -> a -> IO () pROCESS_ID :: Text mkLspCommand :: PluginId -> CommandId -> Text -> Maybe [Value] -> Command mkLspCmdId :: Text -> PluginId -> CommandId -> Text -- | Get the operating system process id for the running server instance. -- This should be the same for the lifetime of the instance, and -- different from that of any other currently running instance. getPid :: IO Text getProcessID :: IO Int installSigUsr1Handler :: IO () -> IO () instance GHC.Classes.Ord Ide.Types.CommandId instance GHC.Classes.Eq Ide.Types.CommandId instance GHC.Read.Read Ide.Types.CommandId instance GHC.Show.Show Ide.Types.CommandId instance GHC.Classes.Ord Ide.Types.PluginId instance GHC.Classes.Eq Ide.Types.PluginId instance GHC.Read.Read Ide.Types.PluginId instance GHC.Show.Show Ide.Types.PluginId instance Data.Aeson.Types.FromJSON.FromJSON Ide.Types.FallbackCodeActionParams instance Data.Aeson.Types.ToJSON.ToJSON Ide.Types.FallbackCodeActionParams instance GHC.Generics.Generic Ide.Types.FallbackCodeActionParams instance GHC.Base.Semigroup (Ide.Types.IdePlugins ideState) instance GHC.Base.Monoid (Ide.Types.IdePlugins ideState) instance GHC.Base.Semigroup (Ide.Types.PluginHandlers a) instance GHC.Base.Monoid (Ide.Types.PluginHandlers a) instance Data.GADT.Internal.GEq Ide.Types.IdeMethod instance Data.GADT.Internal.GCompare Ide.Types.IdeMethod instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentCodeAction instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentCodeLens instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentRename instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentHover instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentDocumentSymbol instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentCompletion instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentFormatting instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentRangeFormatting instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.TextDocumentPrepareCallHierarchy instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.CallHierarchyIncomingCalls instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.CallHierarchyOutgoingCalls instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.CustomMethod instance GHC.Base.Semigroup (Ide.Types.PluginNotificationHandlers a) instance GHC.Base.Monoid (Ide.Types.PluginNotificationHandlers a) instance Data.GADT.Internal.GEq Ide.Types.IdeNotification instance Data.GADT.Internal.GCompare Ide.Types.IdeNotification instance (Language.LSP.Types.Lens.HasTextDocument a doc, Language.LSP.Types.Lens.HasUri doc Language.LSP.Types.Uri.Uri) => Ide.Types.HasTracing a instance Ide.Types.HasTracing Data.Aeson.Types.Internal.Value instance Ide.Types.HasTracing Language.LSP.Types.Command.ExecuteCommandParams instance Ide.Types.HasTracing Language.LSP.Types.WatchedFiles.DidChangeWatchedFilesParams instance Ide.Types.HasTracing Language.LSP.Types.WorkspaceFolders.DidChangeWorkspaceFoldersParams instance Ide.Types.HasTracing Language.LSP.Types.Configuration.DidChangeConfigurationParams instance Ide.Types.HasTracing Language.LSP.Types.Initialize.InitializeParams instance Ide.Types.HasTracing (GHC.Maybe.Maybe Language.LSP.Types.Initialize.InitializedParams) instance Ide.Types.HasTracing Language.LSP.Types.WorkspaceSymbol.WorkspaceSymbolParams instance Ide.Types.HasTracing Language.LSP.Types.CallHierarchy.CallHierarchyIncomingCallsParams instance Ide.Types.HasTracing Language.LSP.Types.CallHierarchy.CallHierarchyOutgoingCallsParams instance Data.String.IsString Ide.Types.PluginId instance Data.String.IsString Ide.Types.CommandId instance GHC.Show.Show (Ide.Types.IdeCommand st) instance GHC.Base.Semigroup Ide.Types.DynFlagsModifications instance GHC.Base.Monoid Ide.Types.DynFlagsModifications module Ide.PluginUtils data WithDeletions IncludeDeletions :: WithDeletions SkipDeletions :: WithDeletions getProcessID :: IO Int -- | Extend to the line below and above to replace newline character. normalize :: Range -> Range makeDiffTextEdit :: Text -> Text -> List TextEdit makeDiffTextEditAdditive :: Text -> Text -> List TextEdit -- | Generate a WorkspaceEdit value from a pair of source Text diffText :: ClientCapabilities -> (Uri, Text) -> Text -> WithDeletions -> WorkspaceEdit -- | A pure version of diffText for testing diffText' :: Bool -> (Uri, Text) -> Text -> WithDeletions -> WorkspaceEdit pluginDescToIdePlugins :: [PluginDescriptor ideState] -> IdePlugins ideState idePluginsToPluginDesc :: IdePlugins ideState -> [PluginDescriptor ideState] responseError :: Text -> ResponseError -- | Returns the current client configuration. It is not wise to -- permanently cache the returned value of this function, as clients can -- at runitime change their configuration. getClientConfig :: MonadLsp Config m => m Config -- | Returns the current plugin configuration. It is not wise to -- permanently cache the returned value of this function, as clients can -- change their configuration at runtime. getPluginConfig :: MonadLsp Config m => PluginId -> m PluginConfig configForPlugin :: Config -> PluginId -> PluginConfig -- | Parse the configuration to check if this plugin is enabled pluginEnabled :: PluginMethod m => SMethod m -> PluginId -> Config -> Bool extractRange :: Range -> Text -> Text -- | Gets the range that covers the entire text fullRange :: Text -> Range mkLspCommand :: PluginId -> CommandId -> Text -> Maybe [Value] -> Command mkLspCmdId :: Text -> PluginId -> CommandId -> Text -- | Get the operating system process id for the running server instance. -- This should be the same for the lifetime of the instance, and -- different from that of any other currently running instance. getPid :: IO Text allLspCmdIds :: Text -> [(PluginId, [PluginCommand ideState])] -> [Text] allLspCmdIds' :: Text -> IdePlugins ideState -> [Text] installSigUsr1Handler :: IO () -> IO () subRange :: Range -> Range -> Bool -- | Returns the value of a property defined by the current plugin. usePropertyLsp :: (HasProperty s k t r, MonadLsp Config m) => KeyNameProxy s -> PluginId -> Properties r -> m (ToHsType t) instance GHC.Classes.Eq Ide.PluginUtils.WithDeletions module Ide.Plugin.ConfigUtils -- | Generates a default Config, but remains only effective items pluginsToDefaultConfig :: IdePlugins a -> Value -- | Generates json schema used in haskell vscode extension Similar to -- pluginsToDefaultConfig but simpler, since schema has a flatten -- structure pluginsToVSCodeExtensionSchema :: IdePlugins a -> Value