-- 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.5.0.0 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 -> !Text -> !Int -> !Map Text PluginConfig -> Config [checkParents] :: Config -> CheckParents [checkProject] :: 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 -> !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 [plcSelectionRangeOn] :: 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 => ToHsType t -> Text -> MetaData t [EnumMetaData] :: IsTEnum t ~ 'True => ToHsType t -> Text -> [ToHsType t] -> [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 data PluginDescriptor (ideState :: *) PluginDescriptor :: !PluginId -> Natural -> !Rules () -> ![PluginCommand ideState] -> PluginHandlers ideState -> ConfigDescriptor -> PluginNotificationHandlers ideState -> DynFlagsModifications -> Maybe (ParserInfo (IdeCommand ideState)) -> [Text] -> PluginDescriptor (ideState :: *) -- | Unique identifier of the plugin. [pluginId] :: PluginDescriptor (ideState :: *) -> !PluginId -- | Plugin handlers are called in priority order, higher priority first [pluginPriority] :: PluginDescriptor (ideState :: *) -> Natural [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)) -- | File extension of the files the plugin is responsible for. The plugin -- is only allowed to handle files with these extensions When writing -- handlers, etc. for this plugin it can be assumed that all handled -- files are of this type. The file extension must have a leading -- .. [pluginFileType] :: PluginDescriptor (ideState :: *) -> [Text] -- | Set up a plugin descriptor, initialized with default values. This is -- plugin descriptor is prepared for haskell files, such as -- -- -- -- and handlers will be enabled for files with the appropriate file -- extensions. defaultPluginDescriptor :: PluginId -> PluginDescriptor ideState -- | Set up a plugin descriptor, initialized with default values. This is -- plugin descriptor is prepared for .cabal files and as such, -- will only respond / run when .cabal files are currently in -- scope. -- -- Handles files with the following extensions: * .cabal defaultCabalPluginDescriptor :: PluginId -> PluginDescriptor ideState defaultPluginPriority :: Natural newtype IdeCommand state IdeCommand :: (state -> IO ()) -> IdeCommand state -- | 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) data IdePlugins ideState -- | Smart constructor that deduplicates plugins pattern IdePlugins :: [PluginDescriptor ideState] -> IdePlugins 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 -- | 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 defaultConfigDescriptor :: ConfigDescriptor configForPlugin :: Config -> PluginId -> PluginConfig -- | Checks that a given plugin is both enabled and the specific feature is -- enabled pluginEnabledConfig :: (PluginConfig -> Bool) -> PluginId -> Config -> Bool -- | An existential wrapper of Properties data CustomConfig CustomConfig :: Properties r -> CustomConfig mkCustomConfig :: Properties r -> CustomConfig data FallbackCodeActionParams FallbackCodeActionParams :: Maybe WorkspaceEdit -> Maybe Command -> FallbackCodeActionParams [fallbackWorkspaceEdit] :: FallbackCodeActionParams -> Maybe WorkspaceEdit [fallbackCommand] :: FallbackCodeActionParams -> Maybe Command -- | 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 class HasTracing a traceWithSpan :: HasTracing a => SpanInFlight -> a -> IO () 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 newtype CommandId CommandId :: Text -> CommandId type CommandFunction ideState a = ideState -> a -> LspM Config (Either ResponseError Value) mkLspCommand :: PluginId -> CommandId -> Text -> Maybe [Value] -> Command mkLspCmdId :: Text -> PluginId -> CommandId -> Text newtype PluginId PluginId :: Text -> PluginId -- | 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) -- | Make a handler for plugins with no extra data mkPluginHandler :: PluginRequestMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState newtype PluginHandlers a PluginHandlers :: DMap IdeMethod (PluginHandler a) -> PluginHandlers a -- | 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 (k :: MethodType) (m :: Method FromClient k) -- | Parse the configuration to check if this plugin is enabled. Perform -- sanity checks on the message to see whether plugin is enabled for this -- message in particular. If a plugin is not enabled, its handlers, -- commands, etc... will not be run for the given message. -- -- Semantically, this method described whether a Plugin is enabled -- configuration wise and is allowed to respond to the message. This -- might depend on the URI that is associated to the Message Parameters, -- but doesn't have to. There are requests with no associated URI that, -- consequentially, can't inspect the URI. -- -- Common reason why a plugin might not be allowed to respond although it -- is enabled: * Plugin can not handle requests associated to the -- specific URI * Since the implementation of cabal plugins HLS -- knows plugins specific for Haskell and specific for Cabal file -- descriptions -- -- Strictly speaking, we are conflating two concepts here: * Dynamically -- enabled (e.g. enabled on a per-message basis) * Statically enabled -- (e.g. by configuration in the lsp-client) * Strictly speaking, this -- might also change dynamically -- -- But there is no use to split it up currently into two different -- methods for now. pluginEnabled :: PluginMethod k m => SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> Bool -- | Parse the configuration to check if this plugin is enabled. Perform -- sanity checks on the message to see whether plugin is enabled for this -- message in particular. If a plugin is not enabled, its handlers, -- commands, etc... will not be run for the given message. -- -- Semantically, this method described whether a Plugin is enabled -- configuration wise and is allowed to respond to the message. This -- might depend on the URI that is associated to the Message Parameters, -- but doesn't have to. There are requests with no associated URI that, -- consequentially, can't inspect the URI. -- -- Common reason why a plugin might not be allowed to respond although it -- is enabled: * Plugin can not handle requests associated to the -- specific URI * Since the implementation of cabal plugins HLS -- knows plugins specific for Haskell and specific for Cabal file -- descriptions -- -- Strictly speaking, we are conflating two concepts here: * Dynamically -- enabled (e.g. enabled on a per-message basis) * Statically enabled -- (e.g. by configuration in the lsp-client) * Strictly speaking, this -- might also change dynamically -- -- But there is no use to split it up currently into two different -- methods for now. pluginEnabled :: (PluginMethod k m, HasTextDocument (MessageParams m) doc, HasUri doc Uri) => SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> Bool type PluginMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m)) newtype PluginNotificationHandler a (m :: Method FromClient Notification) PluginNotificationHandler :: (PluginId -> a -> VFS -> MessageParams m -> LspM Config ()) -> PluginNotificationHandler a (m :: Method FromClient Notification) -- | Make a handler for plugins with no extra data mkPluginNotificationHandler :: PluginNotificationMethod m => SClientMethod (m :: Method FromClient Notification) -> PluginNotificationMethodHandler ideState m -> PluginNotificationHandlers ideState newtype PluginNotificationHandlers a PluginNotificationHandlers :: DMap IdeNotification (PluginNotificationHandler a) -> PluginNotificationHandlers a class PluginMethod Request m => PluginRequestMethod (m :: Method FromClient Request) -- | How to combine responses from different plugins. -- -- For example, for Hover requests, we might have multiple producers of -- Hover information, we do not want to decide which one to display to -- the user but allow here to define how to merge two hover request -- responses into one glorious hover box. -- -- However, sometimes only one handler of a request can realistically -- exist, such as TextDocumentFormatting, it is safe to just -- unconditionally report back one arbitrary result (arbitrary since it -- should only be one anyway). combineResponses :: PluginRequestMethod m => SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (ResponseResult m) -> ResponseResult m -- | How to combine responses from different plugins. -- -- For example, for Hover requests, we might have multiple producers of -- Hover information, we do not want to decide which one to display to -- the user but allow here to define how to merge two hover request -- responses into one glorious hover box. -- -- However, sometimes only one handler of a request can realistically -- exist, such as TextDocumentFormatting, it is safe to just -- unconditionally report back one arbitrary result (arbitrary since it -- should only be one anyway). combineResponses :: (PluginRequestMethod m, Semigroup (ResponseResult m)) => SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (ResponseResult m) -> ResponseResult m getProcessID :: IO Int -- | 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 installSigUsr1Handler :: IO () -> IO () responseError :: Text -> ResponseError lookupCommandProvider :: IdePlugins ideState -> CommandId -> Maybe PluginId 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 Data.Hashable.Class.Hashable Ide.Types.PluginId instance Data.Aeson.Types.FromJSON.FromJSON Ide.Types.PluginId 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 a) instance GHC.Base.Monoid (Ide.Types.IdePlugins a) instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentCodeAction instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentCodeAction instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentDefinition instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentTypeDefinition instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentDocumentHighlight instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentReferences instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.WorkspaceSymbol instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentCodeLens instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentRename instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentHover instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentDocumentSymbol instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentCompletion instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentFormatting instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentRangeFormatting instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentPrepareCallHierarchy instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.TextDocumentSelectionRange instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.CallHierarchyIncomingCalls instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.CallHierarchyOutgoingCalls instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Request 'Language.LSP.Types.Method.CustomMethod instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentDefinition instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentTypeDefinition instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentDocumentHighlight instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentReferences instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.WorkspaceSymbol instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentCodeLens instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentRename instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentHover instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentDocumentSymbol instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentCompletion instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentFormatting instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentRangeFormatting instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentPrepareCallHierarchy instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.TextDocumentSelectionRange instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.CallHierarchyIncomingCalls instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.CallHierarchyOutgoingCalls instance Ide.Types.PluginRequestMethod 'Language.LSP.Types.Method.CustomMethod instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.TextDocumentDidOpen instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.TextDocumentDidChange instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.TextDocumentDidSave instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.TextDocumentDidClose instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.WorkspaceDidChangeWatchedFiles instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.WorkspaceDidChangeWorkspaceFolders instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.WorkspaceDidChangeConfiguration instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.Notification 'Language.LSP.Types.Method.Initialized instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.TextDocumentDidOpen instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.TextDocumentDidChange instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.TextDocumentDidSave instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.TextDocumentDidClose instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.WorkspaceDidChangeWatchedFiles instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.WorkspaceDidChangeWorkspaceFolders instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.WorkspaceDidChangeConfiguration instance Ide.Types.PluginNotificationMethod 'Language.LSP.Types.Method.Initialized instance Data.GADT.Internal.GEq Ide.Types.IdeMethod instance Data.GADT.Internal.GCompare Ide.Types.IdeMethod instance Data.GADT.Internal.GEq Ide.Types.IdeNotification instance Data.GADT.Internal.GCompare Ide.Types.IdeNotification instance GHC.Base.Semigroup (Ide.Types.PluginHandlers a) instance GHC.Base.Monoid (Ide.Types.PluginHandlers a) instance GHC.Base.Semigroup (Ide.Types.PluginNotificationHandlers a) instance GHC.Base.Monoid (Ide.Types.PluginNotificationHandlers a) 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. Perform -- sanity checks on the message to see whether plugin is enabled for this -- message in particular. If a plugin is not enabled, its handlers, -- commands, etc... will not be run for the given message. -- -- Semantically, this method described whether a Plugin is enabled -- configuration wise and is allowed to respond to the message. This -- might depend on the URI that is associated to the Message Parameters, -- but doesn't have to. There are requests with no associated URI that, -- consequentially, can't inspect the URI. -- -- Common reason why a plugin might not be allowed to respond although it -- is enabled: * Plugin can not handle requests associated to the -- specific URI * Since the implementation of cabal plugins HLS -- knows plugins specific for Haskell and specific for Cabal file -- descriptions -- -- Strictly speaking, we are conflating two concepts here: * Dynamically -- enabled (e.g. enabled on a per-message basis) * Statically enabled -- (e.g. by configuration in the lsp-client) * Strictly speaking, this -- might also change dynamically -- -- But there is no use to split it up currently into two different -- methods for now. pluginEnabled :: PluginMethod k m => SMethod m -> MessageParams m -> PluginDescriptor c -> 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 -- | positionInRange returns true if the given Position is in -- the Range. positionInRange :: Position -> 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) getNormalizedFilePath :: Monad m => Uri -> ExceptT String m NormalizedFilePath pluginResponse :: Monad m => ExceptT String m a -> m (Either ResponseError a) handleMaybe :: Monad m => e -> Maybe b -> ExceptT e m b handleMaybeM :: Monad m => e -> m (Maybe b) -> ExceptT e m b throwPluginError :: Monad m => String -> ExceptT String m b 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