-- 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 2.0.0.1 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') -- | A map that allows fast "in-range" filtering. RangeMap is meant -- to be constructed once and cached as part of a Shake rule. If not, the -- map will be rebuilt upon each invocation, yielding slower results -- compared to the list-based approach! -- -- Note that RangeMap falls back to the list-based approach if -- `use-fingertree` flag of `hls-plugin-api` is set to false. module Ide.Plugin.RangeMap -- | A map from code ranges to values. newtype RangeMap a RangeMap :: IntervalMap Position a -> RangeMap a -- | Interval of Position corresponds to a Range [unRangeMap] :: RangeMap a -> IntervalMap Position a -- | Construct a RangeMap from a Range accessor and a list of -- values. fromList :: (a -> Range) -> [a] -> RangeMap a fromList' :: [(Range, a)] -> RangeMap a -- | Filter a RangeMap by a given Range. filterByRange :: Range -> RangeMap a -> [a] instance Data.Traversable.Traversable Ide.Plugin.RangeMap.RangeMap instance Data.Foldable.Foldable Ide.Plugin.RangeMap.RangeMap instance GHC.Base.Functor Ide.Plugin.RangeMap.RangeMap instance GHC.Base.Monoid (Ide.Plugin.RangeMap.RangeMap a) instance GHC.Base.Semigroup (Ide.Plugin.RangeMap.RangeMap a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Ide.Plugin.RangeMap.RangeMap a) 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 -- --
.hs
.lhs
.hs-boot
-- {
-- "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 :: PluginConfig -> Bool -> CustomConfig -> ConfigDescriptor
-- | Initial values for the generic config
[configInitialGenericConfig] :: ConfigDescriptor -> PluginConfig
-- | 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
-- | Lookup the current config for a plugin
configForPlugin :: Config -> PluginDescriptor c -> PluginConfig
-- | Checks that a given plugin is both enabled and the specific feature is
-- enabled
pluginEnabledConfig :: (PluginConfig -> Bool) -> PluginConfig -> 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 Data.Aeson.Types.ToJSON.ToJSON Ide.Types.CheckParents
instance Data.Aeson.Types.FromJSON.FromJSON Ide.Types.CheckParents
instance GHC.Generics.Generic Ide.Types.CheckParents
instance GHC.Show.Show Ide.Types.CheckParents
instance GHC.Classes.Ord Ide.Types.CheckParents
instance GHC.Classes.Eq Ide.Types.CheckParents
instance GHC.Classes.Eq Ide.Types.PluginConfig
instance GHC.Show.Show Ide.Types.PluginConfig
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 GHC.Classes.Eq Ide.Types.Config
instance GHC.Show.Show Ide.Types.Config
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.CompletionItemResolve
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.TextDocumentFoldingRange
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.CompletionItemResolve
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.TextDocumentFoldingRange
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 Ide.Types.HasTracing Language.LSP.Types.Completion.CompletionItem
instance Data.Aeson.Types.ToJSON.ToJSON Ide.Types.Config
instance Data.Default.Class.Default Ide.Types.Config
instance Data.String.IsString Ide.Types.PluginId
instance Data.String.IsString Ide.Types.CommandId
instance Data.Default.Class.Default Ide.Types.PluginConfig
instance Data.Aeson.Types.ToJSON.ToJSON Ide.Types.PluginConfig
instance GHC.Show.Show (Ide.Types.IdeCommand st)
instance GHC.Base.Semigroup Ide.Types.DynFlagsModifications
instance GHC.Base.Monoid Ide.Types.DynFlagsModifications
module Ide.Plugin.Config
-- | Given a DidChangeConfigurationNotification message, this function
-- returns the parsed Config object if possible.
getConfigFromNotification :: IdePlugins s -> 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 -> !Text -> !Int -> !Map PluginId PluginConfig -> Config
[checkParents] :: Config -> CheckParents
[checkProject] :: Config -> !Bool
[formattingProvider] :: Config -> !Text
[cabalFormattingProvider] :: Config -> !Text
[maxCompletions] :: Config -> !Int
[plugins] :: Config -> !Map PluginId PluginConfig
parseConfig :: IdePlugins s -> 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 -> !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
[plcFoldingRangeOn] :: PluginConfig -> !Bool
[plcConfig] :: PluginConfig -> !Object
data CheckParents
NeverCheck :: CheckParents
CheckOnSave :: CheckParents
AlwaysCheck :: CheckParents
module Ide.PluginUtils
-- | Extend to the line below and above to replace newline character.
--
-- -- >>> normalize (Range (Position 5 5) (Position 5 10)) -- Range (Position 5 0) (Position 6 0) --normalize :: Range -> Range -- | Extend Range to the start of the next line. -- --
-- >>> extendNextLine (Range (Position 5 5) (Position 5 10)) -- Range (Position 5 5) (Position 6 0) --extendNextLine :: Range -> Range -- | Extend Range to the start of the current line. -- --
-- >>> extendLineStart (Range (Position 5 5) (Position 5 10)) -- Range (Position 5 0) (Position 5 10) --extendLineStart :: Range -> Range data WithDeletions IncludeDeletions :: WithDeletions SkipDeletions :: WithDeletions getProcessID :: IO Int 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 runtime 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 => PluginDescriptor c -> m PluginConfig -- | Lookup the current config for a plugin configForPlugin :: Config -> PluginDescriptor c -> 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 -> PluginDescriptor c -> 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 -- | Unescape printable escape sequences within double quotes. This is -- useful if you have to call show indirectly, and it escapes some -- characters which you would prefer to display as is. unescape :: Text -> Text 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