Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype IdePlugins ideState = IdePlugins {
- ipMap :: Map PluginId (PluginDescriptor ideState)
- data PluginDescriptor ideState = PluginDescriptor {
- pluginId :: !PluginId
- pluginRules :: !(Rules ())
- pluginCommands :: ![PluginCommand ideState]
- pluginHandlers :: PluginHandlers ideState
- class HasTracing (MessageParams m) => PluginMethod m where
- pluginEnabled :: SMethod m -> PluginId -> Config -> Bool
- combineResponses :: SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (ResponseResult m) -> ResponseResult m
- data IdeMethod (m :: Method FromClient Request) = PluginMethod m => IdeMethod (SMethod m)
- newtype PluginHandler a (m :: Method FromClient Request) = PluginHandler (PluginId -> a -> MessageParams m -> LspM Config (NonEmpty (Either ResponseError (ResponseResult m))))
- newtype PluginHandlers a = PluginHandlers (DMap IdeMethod (PluginHandler a))
- type PluginMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m))
- mkPluginHandler :: PluginMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState
- defaultPluginDescriptor :: PluginId -> PluginDescriptor ideState
- newtype CommandId = CommandId Text
- data PluginCommand ideState = forall a.FromJSON a => PluginCommand {
- commandId :: CommandId
- commandDesc :: Text
- commandFunc :: CommandFunction ideState a
- type CommandFunction ideState a = ideState -> a -> LspM Config (Either ResponseError Value)
- newtype WithSnippets = WithSnippets Bool
- newtype PluginId = PluginId Text
- configForPlugin :: Config -> PluginId -> PluginConfig
- pluginEnabledConfig :: (PluginConfig -> Bool) -> PluginId -> Config -> Bool
- data 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 {}
- otSetUri :: SpanInFlight -> Uri -> IO ()
- class HasTracing a where
- traceWithSpan :: SpanInFlight -> a -> IO ()
- pROCESS_ID :: Text
- mkLspCommand :: PluginId -> CommandId -> Text -> Maybe [Value] -> Command
- mkLspCmdId :: Text -> PluginId -> CommandId -> Text
- getPid :: IO Text
- getProcessID :: IO Int
- installSigUsr1Handler :: IO () -> IO ()
Documentation
newtype IdePlugins ideState Source #
IdePlugins | |
|
data PluginDescriptor ideState Source #
PluginDescriptor | |
|
class HasTracing (MessageParams m) => PluginMethod m where Source #
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
pluginEnabled :: SMethod m -> PluginId -> Config -> Bool Source #
Parse the configuration to check if this plugin is enabled
:: SMethod m | |
-> Config | IDE Configuration |
-> ClientCapabilities | |
-> MessageParams m | |
-> NonEmpty (ResponseResult m) | |
-> ResponseResult m |
How to combine responses from different plugins
default combineResponses :: Semigroup (ResponseResult m) => SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (ResponseResult m) -> ResponseResult m Source #
Instances
data IdeMethod (m :: Method FromClient Request) Source #
Methods which have a PluginMethod instance
PluginMethod m => IdeMethod (SMethod m) |
newtype PluginHandler a (m :: Method FromClient Request) Source #
Combine handlers for the
PluginHandler (PluginId -> a -> MessageParams m -> LspM Config (NonEmpty (Either ResponseError (ResponseResult m)))) |
newtype PluginHandlers a Source #
Instances
Semigroup (PluginHandlers a) Source # | |
Defined in Ide.Types (<>) :: PluginHandlers a -> PluginHandlers a -> PluginHandlers a # sconcat :: NonEmpty (PluginHandlers a) -> PluginHandlers a # stimes :: Integral b => b -> PluginHandlers a -> PluginHandlers a # | |
Monoid (PluginHandlers a) Source # | |
Defined in Ide.Types mempty :: PluginHandlers a # mappend :: PluginHandlers a -> PluginHandlers a -> PluginHandlers a # mconcat :: [PluginHandlers a] -> PluginHandlers a # |
type PluginMethodHandler a m = a -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m)) Source #
mkPluginHandler :: PluginMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState Source #
Make a handler for plugins with no extra data
defaultPluginDescriptor :: PluginId -> PluginDescriptor ideState Source #
data PluginCommand ideState Source #
forall a.FromJSON a => PluginCommand | |
|
type CommandFunction ideState a = ideState -> a -> LspM Config (Either ResponseError Value) Source #
newtype WithSnippets Source #
configForPlugin :: Config -> PluginId -> PluginConfig Source #
pluginEnabledConfig :: (PluginConfig -> Bool) -> PluginId -> Config -> Bool Source #
Checks that a given plugin is both enabled and the specific feature is enabled
data FormattingType Source #
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.
type FormattingMethod m = (HasOptions (MessageParams m) FormattingOptions, HasTextDocument (MessageParams m) TextDocumentIdentifier, ResponseResult m ~ List TextEdit) Source #
type FormattingHandler a = a -> FormattingType -> Text -> NormalizedFilePath -> FormattingOptions -> LspM Config (Either ResponseError (List TextEdit)) Source #
mkFormattingHandlers :: forall a. FormattingHandler a -> PluginHandlers a Source #
responseError :: Text -> ResponseError Source #
data FallbackCodeActionParams Source #
Instances
Generic FallbackCodeActionParams Source # | |
ToJSON FallbackCodeActionParams Source # | |
Defined in Ide.Types | |
FromJSON FallbackCodeActionParams Source # | |
Defined in Ide.Types | |
type Rep FallbackCodeActionParams Source # | |
Defined in Ide.Types type Rep FallbackCodeActionParams = D1 ('MetaData "FallbackCodeActionParams" "Ide.Types" "hls-plugin-api-0.7.1.0-Cz4RfWuYRDFB7ZbZQIs7bC" 'False) (C1 ('MetaCons "FallbackCodeActionParams" 'PrefixI 'True) (S1 ('MetaSel ('Just "fallbackWorkspaceEdit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe WorkspaceEdit)) :*: S1 ('MetaSel ('Just "fallbackCommand") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Command)))) |
class HasTracing a where Source #
Nothing
traceWithSpan :: SpanInFlight -> a -> IO () Source #
Instances
pROCESS_ID :: Text Source #
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.
getProcessID :: IO Int Source #
installSigUsr1Handler :: IO () -> IO () Source #