Ide.Types

hls-plugin-api-2.9.0.0: Haskell Language Server API for plugin communication

Safe Haskell | None
Language | GHC2021

Ide.Types

Synopsis

- data PluginDescriptor ideState = PluginDescriptor {
  - pluginId :: !PluginId
  - pluginDescription :: !Text
  - pluginPriority :: Natural
  - pluginRules :: !(Rules ())
  - pluginCommands :: ![PluginCommand ideState]
  - pluginHandlers :: PluginHandlers ideState
  - pluginConfigDescriptor :: ConfigDescriptor
  - pluginNotificationHandlers :: PluginNotificationHandlers ideState
  - pluginModifyDynflags :: DynFlagsModifications
  - pluginCli :: Maybe (ParserInfo (IdeCommand ideState))
  - pluginFileType :: [Text]
  }
- defaultPluginDescriptor :: PluginId -> Text -> PluginDescriptor ideState
- defaultCabalPluginDescriptor :: PluginId -> Text -> PluginDescriptor ideState
- defaultPluginPriority :: Natural
- describePlugin :: PluginDescriptor c -> Doc ann
- newtype IdeCommand state = IdeCommand (state -> IO ())
- data IdeMethod (m :: Method 'ClientToServer 'Request) = PluginRequestMethod m => IdeMethod (SMethod m)
- data IdeNotification (m :: Method 'ClientToServer 'Notification) = PluginNotificationMethod m => IdeNotification (SMethod m)
- data IdePlugins ideState where
  - pattern IdePlugins :: [PluginDescriptor ideState] -> IdePlugins ideState
- data DynFlagsModifications = DynFlagsModifications {
  - dynFlagsModifyGlobal :: DynFlags -> DynFlags
  - dynFlagsModifyParser :: DynFlags -> DynFlags
  }
- data Config = Config {
  - checkParents :: CheckParents
  - checkProject :: !Bool
  - formattingProvider :: !Text
  - cabalFormattingProvider :: !Text
  - maxCompletions :: !Int
  - sessionLoading :: !SessionLoadingPreferenceConfig
  - plugins :: !(Map PluginId PluginConfig)
  }
- data PluginConfig = PluginConfig {
  - plcGlobalOn :: !Bool
  - plcCallHierarchyOn :: !Bool
  - plcCodeActionsOn :: !Bool
  - plcCodeLensOn :: !Bool
  - plcDiagnosticsOn :: !Bool
  - plcHoverOn :: !Bool
  - plcSymbolsOn :: !Bool
  - plcCompletionOn :: !Bool
  - plcRenameOn :: !Bool
  - plcSelectionRangeOn :: !Bool
  - plcFoldingRangeOn :: !Bool
  - plcSemanticTokensOn :: !Bool
  - plcConfig :: !Object
  }
- data CheckParents
  - = NeverCheck
  - | CheckOnSave
  - | AlwaysCheck
- data SessionLoadingPreferenceConfig
  - = PreferSingleComponentLoading
  - | PreferMultiComponentLoading
- data ConfigDescriptor = ConfigDescriptor {
  - configInitialGenericConfig :: PluginConfig
  - configHasDiagnostics :: Bool
  - configCustomConfig :: CustomConfig
  }
- defaultConfigDescriptor :: ConfigDescriptor
- configForPlugin :: Config -> PluginDescriptor c -> PluginConfig
- data CustomConfig = CustomConfig (Properties r)
- mkCustomConfig :: forall (r :: [PropertyKey]). Properties r -> CustomConfig
- data FallbackCodeActionParams = FallbackCodeActionParams {
  - fallbackWorkspaceEdit :: Maybe WorkspaceEdit
  - fallbackCommand :: Maybe Command
  }
- data FormattingType
  - = FormatText
  - | FormatRange Range
- type FormattingMethod (m :: Method f t) = (HasOptions (MessageParams m) FormattingOptions, HasTextDocument (MessageParams m) TextDocumentIdentifier, MessageResult m ~ ([TextEdit] |? Null))
- type FormattingHandler a = a -> Maybe ProgressToken -> FormattingType -> Text -> NormalizedFilePath -> FormattingOptions -> ExceptT PluginError (HandlerM Config) ([TextEdit] |? Null)
- mkFormattingHandlers :: FormattingHandler a -> PluginHandlers a
- class HasTracing a where
  - traceWithSpan :: SpanInFlight -> a -> IO ()
- data PluginCommand ideState = FromJSON a => PluginCommand {
  - commandId :: CommandId
  - commandDesc :: Text
  - commandFunc :: CommandFunction ideState a
  }
- newtype CommandId = CommandId Text
- type CommandFunction ideState a = ideState -> Maybe ProgressToken -> a -> ExceptT PluginError (HandlerM Config) (Value |? Null)
- mkLspCommand :: PluginId -> CommandId -> Text -> Maybe [Value] -> Command
- mkLspCmdId :: Text -> PluginId -> CommandId -> Text
- newtype PluginId = PluginId Text
- newtype PluginHandler a (m :: Method 'ClientToServer 'Request) = PluginHandler (PluginId -> a -> MessageParams m -> HandlerM Config (NonEmpty (Either PluginError (MessageResult m))))
- mkPluginHandler :: forall ideState (m :: Method 'ClientToServer 'Request). PluginRequestMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState
- data HandlerM config a
- runHandlerM :: HandlerM config a -> LspM config a
- pluginGetClientCapabilities :: HandlerM config ClientCapabilities
- pluginGetVirtualFile :: NormalizedUri -> HandlerM config (Maybe VirtualFile)
- pluginGetVersionedTextDoc :: TextDocumentIdentifier -> HandlerM config VersionedTextDocumentIdentifier
- pluginSendNotification :: forall (m :: Method 'ServerToClient 'Notification) config. SServerMethod m -> MessageParams m -> HandlerM config ()
- pluginSendRequest :: forall (m :: Method 'ServerToClient 'Request) config. SServerMethod m -> MessageParams m -> (Either (TResponseError m) (MessageResult m) -> HandlerM config ()) -> HandlerM config (LspId m)
- pluginWithIndefiniteProgress :: Text -> Maybe ProgressToken -> ProgressCancellable -> ((Text -> HandlerM config ()) -> HandlerM config a) -> HandlerM config a
- newtype PluginHandlers a = PluginHandlers (DMap IdeMethod (PluginHandler a))
- class HasTracing (MessageParams m) => PluginMethod (k :: MessageKind) (m :: Method 'ClientToServer k) where
  - handlesRequest :: SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> HandleRequestResult
- type PluginMethodHandler a (m :: Method f t) = a -> PluginId -> MessageParams m -> ExceptT PluginError (HandlerM Config) (MessageResult m)
- newtype PluginNotificationHandler a (m :: Method 'ClientToServer 'Notification) = PluginNotificationHandler (PluginId -> a -> VFS -> MessageParams m -> LspM Config ())
- mkPluginNotificationHandler :: forall (m :: Method 'ClientToServer 'Notification) ideState. PluginNotificationMethod m => SClientMethod m -> PluginNotificationMethodHandler ideState m -> PluginNotificationHandlers ideState
- newtype PluginNotificationHandlers a = PluginNotificationHandlers (DMap IdeNotification (PluginNotificationHandler a))
- class PluginMethod 'Request m => PluginRequestMethod (m :: Method 'ClientToServer 'Request) where
  - combineResponses :: SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (MessageResult m) -> MessageResult m
- getProcessID :: IO Int
- getPid :: IO Text
- installSigUsr1Handler :: IO () -> IO ()
- lookupCommandProvider :: IdePlugins ideState -> CommandId -> Maybe PluginId
- type ResolveFunction ideState a (m :: Method 'ClientToServer 'Request) = ideState -> PluginId -> MessageParams m -> Uri -> a -> ExceptT PluginError (HandlerM Config) (MessageResult m)
- mkResolveHandler :: forall ideState a (m :: Method 'ClientToServer 'Request). (FromJSON a, PluginRequestMethod m, HasData_ (MessageParams m) (Maybe Value)) => SClientMethod m -> ResolveFunction ideState a m -> PluginHandlers ideState

# Documentation

data PluginDescriptor ideState #

Constructors

PluginDescriptor |
Fields pluginId :: !PluginId pluginDescription :: !Text Unique identifier of the plugin. pluginPriority :: Natural Plugin handlers are called in priority order, higher priority first pluginRules :: !(Rules ()) pluginCommands :: ![PluginCommand ideState] pluginHandlers :: PluginHandlers ideState pluginConfigDescriptor :: ConfigDescriptor pluginNotificationHandlers :: PluginNotificationHandlers ideState pluginModifyDynflags :: DynFlagsModifications pluginCli :: Maybe (ParserInfo (IdeCommand ideState)) pluginFileType :: [Text] 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 `.`.

defaultPluginDescriptor :: PluginId -> Text -> PluginDescriptor ideState #

Set up a plugin descriptor, initialized with default values. This plugin descriptor is prepared for `haskell` files, such as

-     .hs

-     .lhs

-     .hs-boot

and handlers will be enabled for files with the appropriate file extensions.

defaultCabalPluginDescriptor :: PluginId -> Text -> PluginDescriptor ideState #

Set up a plugin descriptor, initialized with default values. This 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`

defaultPluginPriority :: Natural #

describePlugin :: PluginDescriptor c -> Doc ann #

newtype IdeCommand state #

Constructors

IdeCommand (state -> IO ()) |

#### Instances

Instances details

Show (IdeCommand st) # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> IdeCommand st -> ShowS # show :: IdeCommand st -> String # showList :: [IdeCommand st] -> ShowS #

data IdeMethod (m :: Method 'ClientToServer 'Request) #

Methods which have a PluginMethod instance

Constructors

PluginRequestMethod m => IdeMethod (SMethod m) |

#### Instances

Instances details

GCompare IdeMethod # |
Instance details Defined in Ide.Types Methods gcompare :: forall (a :: Method 'ClientToServer 'Request) (b :: Method 'ClientToServer 'Request). IdeMethod a -> IdeMethod b -> GOrdering a b #
GEq IdeMethod # |
Instance details Defined in Ide.Types Methods geq :: forall (a :: Method 'ClientToServer 'Request) (b :: Method 'ClientToServer 'Request). IdeMethod a -> IdeMethod b -> Maybe (a :~: b) #

data IdeNotification (m :: Method 'ClientToServer 'Notification) #

Methods which have a PluginMethod instance

Constructors

PluginNotificationMethod m => IdeNotification (SMethod m) |

#### Instances

Instances details

GCompare IdeNotification # |
Instance details Defined in Ide.Types Methods gcompare :: forall (a :: Method 'ClientToServer 'Notification) (b :: Method 'ClientToServer 'Notification). IdeNotification a -> IdeNotification b -> GOrdering a b #
GEq IdeNotification # |
Instance details Defined in Ide.Types Methods geq :: forall (a :: Method 'ClientToServer 'Notification) (b :: Method 'ClientToServer 'Notification). IdeNotification a -> IdeNotification b -> Maybe (a :~: b) #

data IdePlugins ideState where #

Bundled Patterns

pattern IdePlugins :: [PluginDescriptor ideState] -> IdePlugins ideState | Smart constructor that deduplicates plugins

#### Instances

Instances details

Monoid (IdePlugins a) # |
Instance details Defined in Ide.Types Methods mempty :: IdePlugins a # mappend :: IdePlugins a -> IdePlugins a -> IdePlugins a # mconcat :: [IdePlugins a] -> IdePlugins a #
Semigroup (IdePlugins a) # |
Instance details Defined in Ide.Types Methods (<>) :: IdePlugins a -> IdePlugins a -> IdePlugins a # sconcat :: NonEmpty (IdePlugins a) -> IdePlugins a # stimes :: Integral b => b -> IdePlugins a -> IdePlugins a #

data DynFlagsModifications #

Hooks for modifying the `DynFlags` at different times of the compilation process. Plugins can install a `DynFlagsModifications` via `pluginModifyDynflags` in their `PluginDescriptor`.

Constructors

DynFlagsModifications |
Fields dynFlagsModifyGlobal :: DynFlags -> DynFlags Invoked immediately at the package level. Changes to the `DynFlags` made in `dynFlagsModifyGlobal` are guaranteed to be seen everywhere in the compilation pipeline. dynFlagsModifyParser :: 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.

#### Instances

Instances details

Monoid DynFlagsModifications # |
Instance details Defined in Ide.Types Methods mempty :: DynFlagsModifications # mappend :: DynFlagsModifications -> DynFlagsModifications -> DynFlagsModifications # mconcat :: [DynFlagsModifications] -> DynFlagsModifications #
Semigroup DynFlagsModifications # |
Instance details Defined in Ide.Types Methods (<>) :: DynFlagsModifications -> DynFlagsModifications -> DynFlagsModifications # sconcat :: NonEmpty DynFlagsModifications -> DynFlagsModifications # stimes :: Integral b => b -> DynFlagsModifications -> DynFlagsModifications #

data Config #

We (initially anyway) mirror the hie configuration, so that existing clients can simply switch executable and not have any nasty surprises. There will initially be surprises relating to config options being ignored though.

Constructors

Config |
Fields checkParents :: CheckParents checkProject :: !Bool formattingProvider :: !Text cabalFormattingProvider :: !Text maxCompletions :: !Int sessionLoading :: !SessionLoadingPreferenceConfig plugins :: !(Map PluginId PluginConfig)

#### Instances

Instances details

ToJSON Config # |
Instance details Defined in Ide.Types Methods toJSON :: Config -> Value # toEncoding :: Config -> Encoding # toJSONList :: [Config] -> Value # toEncodingList :: [Config] -> Encoding # omitField :: Config -> Bool #
Default Config # |
Instance details Defined in Ide.Types Methods def :: Config #
Show Config # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> Config -> ShowS # show :: Config -> String # showList :: [Config] -> ShowS #
Eq Config # |
Instance details Defined in Ide.Types Methods (==) :: Config -> Config -> Bool # (/=) :: Config -> Config -> Bool #

data PluginConfig #

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.

Constructors

PluginConfig |
Fields plcGlobalOn :: !Bool plcCallHierarchyOn :: !Bool plcCodeActionsOn :: !Bool plcCodeLensOn :: !Bool plcDiagnosticsOn :: !Bool plcHoverOn :: !Bool plcSymbolsOn :: !Bool plcCompletionOn :: !Bool plcRenameOn :: !Bool plcSelectionRangeOn :: !Bool plcFoldingRangeOn :: !Bool plcSemanticTokensOn :: !Bool plcConfig :: !Object

#### Instances

Instances details

ToJSON PluginConfig # |
Instance details Defined in Ide.Types Methods toJSON :: PluginConfig -> Value # toEncoding :: PluginConfig -> Encoding # toJSONList :: [PluginConfig] -> Value # toEncodingList :: [PluginConfig] -> Encoding # omitField :: PluginConfig -> Bool #
Default PluginConfig # |
Instance details Defined in Ide.Types Methods def :: PluginConfig #
Show PluginConfig # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> PluginConfig -> ShowS # show :: PluginConfig -> String # showList :: [PluginConfig] -> ShowS #
Eq PluginConfig # |
Instance details Defined in Ide.Types Methods (==) :: PluginConfig -> PluginConfig -> Bool # (/=) :: PluginConfig -> PluginConfig -> Bool #

data CheckParents #

Constructors

NeverCheck |
CheckOnSave |
AlwaysCheck |

#### Instances

Instances details

FromJSON CheckParents # |
Instance details Defined in Ide.Types Methods parseJSON :: Value -> Parser CheckParents # parseJSONList :: Value -> Parser [CheckParents] # omittedField :: Maybe CheckParents #
ToJSON CheckParents # |
Instance details Defined in Ide.Types Methods toJSON :: CheckParents -> Value # toEncoding :: CheckParents -> Encoding # toJSONList :: [CheckParents] -> Value # toEncodingList :: [CheckParents] -> Encoding # omitField :: CheckParents -> Bool #
Generic CheckParents # |
Instance details Defined in Ide.Types Associated Types
type Rep CheckParents |
Instance details Defined in Ide.Types type Rep CheckParents = D1 ('MetaData "CheckParents" "Ide.Types" "hls-plugin-api-2.9.0.0-HER889dnREQKWJAwDe5OEw" 'False) (C1 ('MetaCons "NeverCheck" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CheckOnSave" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AlwaysCheck" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: CheckParents -> Rep CheckParents x # to :: Rep CheckParents x -> CheckParents #
Show CheckParents # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> CheckParents -> ShowS # show :: CheckParents -> String # showList :: [CheckParents] -> ShowS #
Eq CheckParents # |
Instance details Defined in Ide.Types Methods (==) :: CheckParents -> CheckParents -> Bool # (/=) :: CheckParents -> CheckParents -> Bool #
Ord CheckParents # |
Instance details Defined in Ide.Types Methods compare :: CheckParents -> CheckParents -> Ordering # (<) :: CheckParents -> CheckParents -> Bool # (<=) :: CheckParents -> CheckParents -> Bool # (>) :: CheckParents -> CheckParents -> Bool # (>=) :: CheckParents -> CheckParents -> Bool # max :: CheckParents -> CheckParents -> CheckParents # min :: CheckParents -> CheckParents -> CheckParents #
type Rep CheckParents # |
Instance details Defined in Ide.Types type Rep CheckParents = D1 ('MetaData "CheckParents" "Ide.Types" "hls-plugin-api-2.9.0.0-HER889dnREQKWJAwDe5OEw" 'False) (C1 ('MetaCons "NeverCheck" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CheckOnSave" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AlwaysCheck" 'PrefixI 'False) (U1 :: Type -> Type)))

data SessionLoadingPreferenceConfig #

Constructors

PreferSingleComponentLoading | Always load only a singleComponent when a new component is discovered.
PreferMultiComponentLoading | Always prefer loading multiple components in the cradle at once. This might not be always possible, if the tool doesn't support multiple components loading. The cradle can decide how to handle these situations, and whether to honour the preference at all.

#### Instances

Instances details

FromJSON SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Methods parseJSON :: Value -> Parser SessionLoadingPreferenceConfig # parseJSONList :: Value -> Parser [SessionLoadingPreferenceConfig] # omittedField :: Maybe SessionLoadingPreferenceConfig #
ToJSON SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Methods toJSON :: SessionLoadingPreferenceConfig -> Value # toEncoding :: SessionLoadingPreferenceConfig -> Encoding # toJSONList :: [SessionLoadingPreferenceConfig] -> Value # toEncodingList :: [SessionLoadingPreferenceConfig] -> Encoding # omitField :: SessionLoadingPreferenceConfig -> Bool #
Generic SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Associated Types
type Rep SessionLoadingPreferenceConfig |
Instance details Defined in Ide.Types type Rep SessionLoadingPreferenceConfig = D1 ('MetaData "SessionLoadingPreferenceConfig" "Ide.Types" "hls-plugin-api-2.9.0.0-HER889dnREQKWJAwDe5OEw" 'False) (C1 ('MetaCons "PreferSingleComponentLoading" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PreferMultiComponentLoading" 'PrefixI 'False) (U1 :: Type -> Type))
Methods from :: SessionLoadingPreferenceConfig -> Rep SessionLoadingPreferenceConfig x # to :: Rep SessionLoadingPreferenceConfig x -> SessionLoadingPreferenceConfig #
Show SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> SessionLoadingPreferenceConfig -> ShowS # show :: SessionLoadingPreferenceConfig -> String # showList :: [SessionLoadingPreferenceConfig] -> ShowS #
Eq SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Methods (==) :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Bool # (/=) :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Bool #
Ord SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Methods compare :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Ordering # (<) :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Bool # (<=) :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Bool # (>) :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Bool # (>=) :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> Bool # max :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig # min :: SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig -> SessionLoadingPreferenceConfig #
Pretty SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types Methods pretty :: SessionLoadingPreferenceConfig -> Doc ann # prettyList :: [SessionLoadingPreferenceConfig] -> Doc ann #
type Rep SessionLoadingPreferenceConfig # |
Instance details Defined in Ide.Types type Rep SessionLoadingPreferenceConfig = D1 ('MetaData "SessionLoadingPreferenceConfig" "Ide.Types" "hls-plugin-api-2.9.0.0-HER889dnREQKWJAwDe5OEw" 'False) (C1 ('MetaCons "PreferSingleComponentLoading" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PreferMultiComponentLoading" 'PrefixI 'False) (U1 :: Type -> Type))

data ConfigDescriptor #

Describes the configuration of a plugin. A plugin may be configurable as can be seen below:

    {
     "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`.

Constructors

ConfigDescriptor |
Fields configInitialGenericConfig :: PluginConfig Initial values for the generic config configHasDiagnostics :: 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 configCustomConfig :: CustomConfig Custom config.

defaultConfigDescriptor :: ConfigDescriptor #

configForPlugin :: Config -> PluginDescriptor c -> PluginConfig #

Lookup the current config for a plugin

data CustomConfig #

An existential wrapper of `Properties`

Constructors

CustomConfig (Properties r) |

mkCustomConfig :: forall (r :: [PropertyKey]). Properties r -> CustomConfig #

data FallbackCodeActionParams #

Constructors

FallbackCodeActionParams |
Fields fallbackWorkspaceEdit :: Maybe WorkspaceEdit fallbackCommand :: Maybe Command

#### Instances

Instances details

FromJSON FallbackCodeActionParams # |
Instance details Defined in Ide.Types Methods parseJSON :: Value -> Parser FallbackCodeActionParams # parseJSONList :: Value -> Parser [FallbackCodeActionParams] # omittedField :: Maybe FallbackCodeActionParams #
ToJSON FallbackCodeActionParams # |
Instance details Defined in Ide.Types Methods toJSON :: FallbackCodeActionParams -> Value # toEncoding :: FallbackCodeActionParams -> Encoding # toJSONList :: [FallbackCodeActionParams] -> Value # toEncodingList :: [FallbackCodeActionParams] -> Encoding # omitField :: FallbackCodeActionParams -> Bool #
Generic FallbackCodeActionParams # |
Instance details Defined in Ide.Types Associated Types
type Rep FallbackCodeActionParams |
Instance details Defined in Ide.Types type Rep FallbackCodeActionParams = D1 ('MetaData "FallbackCodeActionParams" "Ide.Types" "hls-plugin-api-2.9.0.0-HER889dnREQKWJAwDe5OEw" '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))))
Methods from :: FallbackCodeActionParams -> Rep FallbackCodeActionParams x # to :: Rep FallbackCodeActionParams x -> FallbackCodeActionParams #
type Rep FallbackCodeActionParams # |
Instance details Defined in Ide.Types type Rep FallbackCodeActionParams = D1 ('MetaData "FallbackCodeActionParams" "Ide.Types" "hls-plugin-api-2.9.0.0-HER889dnREQKWJAwDe5OEw" '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))))

data FormattingType #

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.

Constructors

FormatText |
FormatRange Range |

type FormattingMethod (m :: Method f t) = (HasOptions (MessageParams m) FormattingOptions, HasTextDocument (MessageParams m) TextDocumentIdentifier, MessageResult m ~ ([TextEdit] |? Null)) #

type FormattingHandler a = a -> Maybe ProgressToken -> FormattingType -> Text -> NormalizedFilePath -> FormattingOptions -> ExceptT PluginError (HandlerM Config) ([TextEdit] |? Null) #

mkFormattingHandlers :: FormattingHandler a -> PluginHandlers a #

class HasTracing a where #

Minimal complete definition

Nothing

Methods

traceWithSpan :: SpanInFlight -> a -> IO () #

#### Instances

Instances details

HasTracing Value # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> Value -> IO () #
HasTracing CallHierarchyIncomingCallsParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> CallHierarchyIncomingCallsParams -> IO () #
HasTracing CallHierarchyOutgoingCallsParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> CallHierarchyOutgoingCallsParams -> IO () #
HasTracing CodeAction # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> CodeAction -> IO () #
HasTracing CodeLens # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> CodeLens -> IO () #
HasTracing CompletionItem # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> CompletionItem -> IO () #
HasTracing DidChangeConfigurationParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> DidChangeConfigurationParams -> IO () #
HasTracing DidChangeWatchedFilesParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> DidChangeWatchedFilesParams -> IO () #
HasTracing DidChangeWorkspaceFoldersParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> DidChangeWorkspaceFoldersParams -> IO () #
HasTracing DocumentLink # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> DocumentLink -> IO () #
HasTracing ExecuteCommandParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> ExecuteCommandParams -> IO () #
HasTracing InitializeParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> InitializeParams -> IO () #
HasTracing InitializedParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> InitializedParams -> IO () #
HasTracing InlayHint # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> InlayHint -> IO () #
HasTracing WorkspaceSymbol # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> WorkspaceSymbol -> IO () #
HasTracing WorkspaceSymbolParams # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> WorkspaceSymbolParams -> IO () #
(HasTextDocument a doc, HasUri doc Uri) => HasTracing a # |
Instance details Defined in Ide.Types Methods traceWithSpan :: SpanInFlight -> a -> IO () #

data PluginCommand ideState #

Constructors

FromJSON a => PluginCommand |
Fields commandId :: CommandId commandDesc :: Text commandFunc :: CommandFunction ideState a

newtype CommandId #

Constructors

CommandId Text |

#### Instances

Instances details

IsString CommandId # |
Instance details Defined in Ide.Types Methods fromString :: String -> CommandId #
Read CommandId # |
Instance details Defined in Ide.Types Methods readsPrec :: Int -> ReadS CommandId # readList :: ReadS [CommandId] # readPrec :: ReadPrec CommandId # readListPrec :: ReadPrec [CommandId] #
Show CommandId # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> CommandId -> ShowS # show :: CommandId -> String # showList :: [CommandId] -> ShowS #
Eq CommandId # |
Instance details Defined in Ide.Types Methods (==) :: CommandId -> CommandId -> Bool # (/=) :: CommandId -> CommandId -> Bool #
Ord CommandId # |
Instance details Defined in Ide.Types Methods compare :: CommandId -> CommandId -> Ordering # (<) :: CommandId -> CommandId -> Bool # (<=) :: CommandId -> CommandId -> Bool # (>) :: CommandId -> CommandId -> Bool # (>=) :: CommandId -> CommandId -> Bool # max :: CommandId -> CommandId -> CommandId # min :: CommandId -> CommandId -> CommandId #

type CommandFunction ideState a = ideState -> Maybe ProgressToken -> a -> ExceptT PluginError (HandlerM Config) (Value |? Null) #

mkLspCommand :: PluginId -> CommandId -> Text -> Maybe [Value] -> Command #

mkLspCmdId :: Text -> PluginId -> CommandId -> Text #

newtype PluginId #

Constructors

PluginId Text |

#### Instances

Instances details

FromJSON PluginId # |
Instance details Defined in Ide.Types Methods parseJSON :: Value -> Parser PluginId # parseJSONList :: Value -> Parser [PluginId] # omittedField :: Maybe PluginId #
ToJSON PluginId # |
Instance details Defined in Ide.Types Methods toJSON :: PluginId -> Value # toEncoding :: PluginId -> Encoding # toJSONList :: [PluginId] -> Value # toEncodingList :: [PluginId] -> Encoding # omitField :: PluginId -> Bool #
IsString PluginId # |
Instance details Defined in Ide.Types Methods fromString :: String -> PluginId #
Read PluginId # |
Instance details Defined in Ide.Types Methods readsPrec :: Int -> ReadS PluginId # readList :: ReadS [PluginId] # readPrec :: ReadPrec PluginId # readListPrec :: ReadPrec [PluginId] #
Show PluginId # |
Instance details Defined in Ide.Types Methods showsPrec :: Int -> PluginId -> ShowS # show :: PluginId -> String # showList :: [PluginId] -> ShowS #
Eq PluginId # |
Instance details Defined in Ide.Types Methods (==) :: PluginId -> PluginId -> Bool # (/=) :: PluginId -> PluginId -> Bool #
Ord PluginId # |
Instance details Defined in Ide.Types Methods compare :: PluginId -> PluginId -> Ordering # (<) :: PluginId -> PluginId -> Bool # (<=) :: PluginId -> PluginId -> Bool # (>) :: PluginId -> PluginId -> Bool # (>=) :: PluginId -> PluginId -> Bool # max :: PluginId -> PluginId -> PluginId # min :: PluginId -> PluginId -> PluginId #
Hashable PluginId # |
Instance details Defined in Ide.Types Methods hashWithSalt :: Int -> PluginId -> Int # hash :: PluginId -> Int #

newtype PluginHandler a (m :: Method 'ClientToServer 'Request) #

Combine handlers for the

Constructors

PluginHandler (PluginId -> a -> MessageParams m -> HandlerM Config (NonEmpty (Either PluginError (MessageResult m)))) |

mkPluginHandler :: forall ideState (m :: Method 'ClientToServer 'Request). PluginRequestMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState #

Make a handler for plugins. For how resolve works with this see Note [Resolve in PluginHandlers]

data HandlerM config a #

Restricted version of `LspM` specific to plugins.

We plan to use this monad for running plugins instead of `LspM`, since there are parts of the LSP server state which plugins should not access directly, but instead only via the build system. Note that this restriction of the LSP server state has not yet been implemented. See `pluginGetVirtualFile`.

#### Instances

Instances details

MonadIO (HandlerM config) # |
Instance details Defined in Ide.Types Methods liftIO :: IO a -> HandlerM config a #
Applicative (HandlerM config) # |
Instance details Defined in Ide.Types Methods pure :: a -> HandlerM config a # (<*>) :: HandlerM config (a -> b) -> HandlerM config a -> HandlerM config b # liftA2 :: (a -> b -> c) -> HandlerM config a -> HandlerM config b -> HandlerM config c # (*>) :: HandlerM config a -> HandlerM config b -> HandlerM config b # (<*) :: HandlerM config a -> HandlerM config b -> HandlerM config a #
Functor (HandlerM config) # |
Instance details Defined in Ide.Types Methods fmap :: (a -> b) -> HandlerM config a -> HandlerM config b # (<$) :: a -> HandlerM config b -> HandlerM config a #
Monad (HandlerM config) # |
Instance details Defined in Ide.Types Methods (>>=) :: HandlerM config a -> (a -> HandlerM config b) -> HandlerM config b # (>>) :: HandlerM config a -> HandlerM config b -> HandlerM config b # return :: a -> HandlerM config a #
MonadUnliftIO (HandlerM config) # |
Instance details Defined in Ide.Types Methods withRunInIO :: ((forall a. HandlerM config a -> IO a) -> IO b) -> HandlerM config b #

runHandlerM :: HandlerM config a -> LspM config a #

pluginGetClientCapabilities :: HandlerM config ClientCapabilities #

Wrapper of `getClientCapabilities` for HandlerM

pluginGetVirtualFile :: NormalizedUri -> HandlerM config (Maybe VirtualFile) #

Wrapper of `getVirtualFile` for HandlerM

TODO: To be replaced by a lookup of the Shake build graph

pluginGetVersionedTextDoc :: TextDocumentIdentifier -> HandlerM config VersionedTextDocumentIdentifier #

Version of `getVersionedTextDoc` for HandlerM

TODO: Should use `pluginGetVirtualFile` instead of wrapping `getVersionedTextDoc`. At the time of writing, `getVersionedTextDoc` of the "lsp" package is implemented with `getVirtualFile`.

pluginSendNotification :: forall (m :: Method 'ServerToClient 'Notification) config. SServerMethod m -> MessageParams m -> HandlerM config () #

Wrapper of 'sendNotification for HandlerM

TODO: Return notification in result instead of calling `sendNotification` directly

pluginSendRequest :: forall (m :: Method 'ServerToClient 'Request) config. SServerMethod m -> MessageParams m -> (Either (TResponseError m) (MessageResult m) -> HandlerM config ()) -> HandlerM config (LspId m) #

Wrapper of `sendRequest` for HandlerM

TODO: Return request in result instead of calling `sendRequest` directly

pluginWithIndefiniteProgress :: Text -> Maybe ProgressToken -> ProgressCancellable -> ((Text -> HandlerM config ()) -> HandlerM config a) -> HandlerM config a #

Wrapper of `withIndefiniteProgress` for HandlerM

newtype PluginHandlers a #

Constructors

PluginHandlers (DMap IdeMethod (PluginHandler a)) |

#### Instances

Instances details

Monoid (PluginHandlers a) # |
Instance details Defined in Ide.Types Methods mempty :: PluginHandlers a # mappend :: PluginHandlers a -> PluginHandlers a -> PluginHandlers a # mconcat :: [PluginHandlers a] -> PluginHandlers a #
Semigroup (PluginHandlers a) # |
Instance details Defined in Ide.Types Methods (<>) :: PluginHandlers a -> PluginHandlers a -> PluginHandlers a # sconcat :: NonEmpty (PluginHandlers a) -> PluginHandlers a # stimes :: Integral b => b -> PluginHandlers a -> PluginHandlers a #

class HasTracing (MessageParams m) => PluginMethod (k :: MessageKind) (m :: Method 'ClientToServer k) where #

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`

Minimal complete definition

Nothing

Methods

handlesRequest #

Arguments

:: SMethod m | Method type.
-> MessageParams m | Whether a plugin is enabled might depend on the message parameters e.g. `pluginFileType` specifies which file extensions a plugin is allowed to handle
-> PluginDescriptor c | Contains meta information such as PluginId and which file types this plugin is able to handle.
-> Config | Generic config description, expected to contain `PluginConfig` configuration for this plugin
-> HandleRequestResult | Is this plugin enabled and allowed to respond to the given request with the given parameters?

Parse the configuration to check if this plugin is globally enabled, and if the feature which handles this method is enabled. Perform sanity checks on the message to see whether the plugin handles this message in particular. This class is only used to determine whether a plugin can handle a specific request. Commands and rules do not use this logic to determine whether or not they are run.

A common reason why a plugin won't handle a request even though it is enabled: * The plugin cannot handle requests associated with the specific URI * Since the implementation of cabal plugins HLS knows plugins specific to Haskell and specific to Cabal file descriptions * The resolve request is not routed to that specific plugin. Each resolve request needs to be routed to only one plugin.

Strictly speaking, we are conflating two concepts here: * Dynamically enabled (e.g. 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 into two different methods for now.

default handlesRequest :: (HasTextDocument (MessageParams m) doc, HasUri doc Uri) => SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> HandleRequestResult #

#### Instances

Instances details

PluginMethod 'Notification 'Method_Initialized # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_Initialized -> MessageParams 'Method_Initialized -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_TextDocumentDidChange # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDidChange -> MessageParams 'Method_TextDocumentDidChange -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_TextDocumentDidClose # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDidClose -> MessageParams 'Method_TextDocumentDidClose -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_TextDocumentDidOpen # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDidOpen -> MessageParams 'Method_TextDocumentDidOpen -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_TextDocumentDidSave # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDidSave -> MessageParams 'Method_TextDocumentDidSave -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_WorkspaceDidChangeConfiguration # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_WorkspaceDidChangeConfiguration -> MessageParams 'Method_WorkspaceDidChangeConfiguration -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_WorkspaceDidChangeWatchedFiles # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_WorkspaceDidChangeWatchedFiles -> MessageParams 'Method_WorkspaceDidChangeWatchedFiles -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Notification 'Method_WorkspaceDidChangeWorkspaceFolders # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_WorkspaceDidChangeWorkspaceFolders -> MessageParams 'Method_WorkspaceDidChangeWorkspaceFolders -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_CallHierarchyIncomingCalls # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_CallHierarchyIncomingCalls -> MessageParams 'Method_CallHierarchyIncomingCalls -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_CallHierarchyOutgoingCalls # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_CallHierarchyOutgoingCalls -> MessageParams 'Method_CallHierarchyOutgoingCalls -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_CodeActionResolve # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_CodeActionResolve -> MessageParams 'Method_CodeActionResolve -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_CodeLensResolve # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_CodeLensResolve -> MessageParams 'Method_CodeLensResolve -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_CompletionItemResolve # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_CompletionItemResolve -> MessageParams 'Method_CompletionItemResolve -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentCodeAction # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentCodeAction -> MessageParams 'Method_TextDocumentCodeAction -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentCodeLens # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentCodeLens -> MessageParams 'Method_TextDocumentCodeLens -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentCompletion # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentCompletion -> MessageParams 'Method_TextDocumentCompletion -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentDefinition # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDefinition -> MessageParams 'Method_TextDocumentDefinition -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentDocumentHighlight # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDocumentHighlight -> MessageParams 'Method_TextDocumentDocumentHighlight -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentDocumentSymbol # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentDocumentSymbol -> MessageParams 'Method_TextDocumentDocumentSymbol -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentFoldingRange # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentFoldingRange -> MessageParams 'Method_TextDocumentFoldingRange -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentFormatting # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentFormatting -> MessageParams 'Method_TextDocumentFormatting -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentHover # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentHover -> MessageParams 'Method_TextDocumentHover -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentPrepareCallHierarchy # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentPrepareCallHierarchy -> MessageParams 'Method_TextDocumentPrepareCallHierarchy -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentPrepareRename # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentPrepareRename -> MessageParams 'Method_TextDocumentPrepareRename -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentRangeFormatting # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentRangeFormatting -> MessageParams 'Method_TextDocumentRangeFormatting -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentReferences # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentReferences -> MessageParams 'Method_TextDocumentReferences -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentRename # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentRename -> MessageParams 'Method_TextDocumentRename -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentSelectionRange # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentSelectionRange -> MessageParams 'Method_TextDocumentSelectionRange -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentSemanticTokensFull # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentSemanticTokensFull -> MessageParams 'Method_TextDocumentSemanticTokensFull -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentSemanticTokensFullDelta # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentSemanticTokensFullDelta -> MessageParams 'Method_TextDocumentSemanticTokensFullDelta -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_TextDocumentTypeDefinition # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_TextDocumentTypeDefinition -> MessageParams 'Method_TextDocumentTypeDefinition -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_WorkspaceExecuteCommand # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_WorkspaceExecuteCommand -> MessageParams 'Method_WorkspaceExecuteCommand -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request 'Method_WorkspaceSymbol # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod 'Method_WorkspaceSymbol -> MessageParams 'Method_WorkspaceSymbol -> PluginDescriptor c -> Config -> HandleRequestResult #
PluginMethod 'Request ('Method_CustomMethod m :: Method 'ClientToServer 'Request) # |
Instance details Defined in Ide.Types Methods handlesRequest :: SMethod ('Method_CustomMethod m :: Method 'ClientToServer 'Request) -> MessageParams ('Method_CustomMethod m :: Method 'ClientToServer 'Request) -> PluginDescriptor c -> Config -> HandleRequestResult #

type PluginMethodHandler a (m :: Method f t) = a -> PluginId -> MessageParams m -> ExceptT PluginError (HandlerM Config) (MessageResult m) #

newtype PluginNotificationHandler a (m :: Method 'ClientToServer 'Notification) #

Constructors

PluginNotificationHandler (PluginId -> a -> VFS -> MessageParams m -> LspM Config ()) |

mkPluginNotificationHandler :: forall (m :: Method 'ClientToServer 'Notification) ideState. PluginNotificationMethod m => SClientMethod m -> PluginNotificationMethodHandler ideState m -> PluginNotificationHandlers ideState #

Make a handler for plugins with no extra data

newtype PluginNotificationHandlers a #

Constructors

PluginNotificationHandlers (DMap IdeNotification (PluginNotificationHandler a)) |

#### Instances

Instances details

Monoid (PluginNotificationHandlers a) # |
Instance details Defined in Ide.Types Methods mempty :: PluginNotificationHandlers a # mappend :: PluginNotificationHandlers a -> PluginNotificationHandlers a -> PluginNotificationHandlers a # mconcat :: [PluginNotificationHandlers a] -> PluginNotificationHandlers a #
Semigroup (PluginNotificationHandlers a) # |
Instance details Defined in Ide.Types Methods (<>) :: PluginNotificationHandlers a -> PluginNotificationHandlers a -> PluginNotificationHandlers a # sconcat :: NonEmpty (PluginNotificationHandlers a) -> PluginNotificationHandlers a # stimes :: Integral b => b -> PluginNotificationHandlers a -> PluginNotificationHandlers a #

class PluginMethod 'Request m => PluginRequestMethod (m :: Method 'ClientToServer 'Request) where #

Minimal complete definition

Nothing

Methods

combineResponses #

Arguments

:: SMethod m |
-> Config | IDE Configuration
-> ClientCapabilities |
-> MessageParams m |
-> NonEmpty (MessageResult m) |
-> MessageResult 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 instead allow to define how to merge two hover request responses into one glorious hover box.

However, as 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).

default combineResponses :: Semigroup (MessageResult m) => SMethod m -> Config -> ClientCapabilities -> MessageParams m -> NonEmpty (MessageResult m) -> MessageResult m #

#### Instances

Instances details

PluginRequestMethod 'Method_CallHierarchyIncomingCalls # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_CallHierarchyIncomingCalls -> Config -> ClientCapabilities -> MessageParams 'Method_CallHierarchyIncomingCalls -> NonEmpty (MessageResult 'Method_CallHierarchyIncomingCalls) -> MessageResult 'Method_CallHierarchyIncomingCalls #
PluginRequestMethod 'Method_CallHierarchyOutgoingCalls # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_CallHierarchyOutgoingCalls -> Config -> ClientCapabilities -> MessageParams 'Method_CallHierarchyOutgoingCalls -> NonEmpty (MessageResult 'Method_CallHierarchyOutgoingCalls) -> MessageResult 'Method_CallHierarchyOutgoingCalls #
PluginRequestMethod 'Method_CodeActionResolve # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_CodeActionResolve -> Config -> ClientCapabilities -> MessageParams 'Method_CodeActionResolve -> NonEmpty (MessageResult 'Method_CodeActionResolve) -> MessageResult 'Method_CodeActionResolve #
PluginRequestMethod 'Method_CodeLensResolve # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_CodeLensResolve -> Config -> ClientCapabilities -> MessageParams 'Method_CodeLensResolve -> NonEmpty (MessageResult 'Method_CodeLensResolve) -> MessageResult 'Method_CodeLensResolve #
PluginRequestMethod 'Method_CompletionItemResolve # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_CompletionItemResolve -> Config -> ClientCapabilities -> MessageParams 'Method_CompletionItemResolve -> NonEmpty (MessageResult 'Method_CompletionItemResolve) -> MessageResult 'Method_CompletionItemResolve #
PluginRequestMethod 'Method_TextDocumentCodeAction # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentCodeAction -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentCodeAction -> NonEmpty (MessageResult 'Method_TextDocumentCodeAction) -> MessageResult 'Method_TextDocumentCodeAction #
PluginRequestMethod 'Method_TextDocumentCodeLens # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentCodeLens -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentCodeLens -> NonEmpty (MessageResult 'Method_TextDocumentCodeLens) -> MessageResult 'Method_TextDocumentCodeLens #
PluginRequestMethod 'Method_TextDocumentCompletion # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentCompletion -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentCompletion -> NonEmpty (MessageResult 'Method_TextDocumentCompletion) -> MessageResult 'Method_TextDocumentCompletion #
PluginRequestMethod 'Method_TextDocumentDefinition # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentDefinition -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentDefinition -> NonEmpty (MessageResult 'Method_TextDocumentDefinition) -> MessageResult 'Method_TextDocumentDefinition #
PluginRequestMethod 'Method_TextDocumentDocumentHighlight # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentDocumentHighlight -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentDocumentHighlight -> NonEmpty (MessageResult 'Method_TextDocumentDocumentHighlight) -> MessageResult 'Method_TextDocumentDocumentHighlight #
PluginRequestMethod 'Method_TextDocumentDocumentSymbol # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentDocumentSymbol -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentDocumentSymbol -> NonEmpty (MessageResult 'Method_TextDocumentDocumentSymbol) -> MessageResult 'Method_TextDocumentDocumentSymbol #
PluginRequestMethod 'Method_TextDocumentFoldingRange # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentFoldingRange -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentFoldingRange -> NonEmpty (MessageResult 'Method_TextDocumentFoldingRange) -> MessageResult 'Method_TextDocumentFoldingRange #
PluginRequestMethod 'Method_TextDocumentFormatting # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentFormatting -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentFormatting -> NonEmpty (MessageResult 'Method_TextDocumentFormatting) -> MessageResult 'Method_TextDocumentFormatting #
PluginRequestMethod 'Method_TextDocumentHover # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentHover -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentHover -> NonEmpty (MessageResult 'Method_TextDocumentHover) -> MessageResult 'Method_TextDocumentHover #
PluginRequestMethod 'Method_TextDocumentPrepareCallHierarchy # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentPrepareCallHierarchy -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentPrepareCallHierarchy -> NonEmpty (MessageResult 'Method_TextDocumentPrepareCallHierarchy) -> MessageResult 'Method_TextDocumentPrepareCallHierarchy #
PluginRequestMethod 'Method_TextDocumentPrepareRename # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentPrepareRename -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentPrepareRename -> NonEmpty (MessageResult 'Method_TextDocumentPrepareRename) -> MessageResult 'Method_TextDocumentPrepareRename #
PluginRequestMethod 'Method_TextDocumentRangeFormatting # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentRangeFormatting -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentRangeFormatting -> NonEmpty (MessageResult 'Method_TextDocumentRangeFormatting) -> MessageResult 'Method_TextDocumentRangeFormatting #
PluginRequestMethod 'Method_TextDocumentReferences # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentReferences -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentReferences -> NonEmpty (MessageResult 'Method_TextDocumentReferences) -> MessageResult 'Method_TextDocumentReferences #
PluginRequestMethod 'Method_TextDocumentRename # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentRename -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentRename -> NonEmpty (MessageResult 'Method_TextDocumentRename) -> MessageResult 'Method_TextDocumentRename #
PluginRequestMethod 'Method_TextDocumentSelectionRange # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentSelectionRange -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentSelectionRange -> NonEmpty (MessageResult 'Method_TextDocumentSelectionRange) -> MessageResult 'Method_TextDocumentSelectionRange #
PluginRequestMethod 'Method_TextDocumentSemanticTokensFull # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentSemanticTokensFull -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentSemanticTokensFull -> NonEmpty (MessageResult 'Method_TextDocumentSemanticTokensFull) -> MessageResult 'Method_TextDocumentSemanticTokensFull #
PluginRequestMethod 'Method_TextDocumentSemanticTokensFullDelta # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentSemanticTokensFullDelta -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentSemanticTokensFullDelta -> NonEmpty (MessageResult 'Method_TextDocumentSemanticTokensFullDelta) -> MessageResult 'Method_TextDocumentSemanticTokensFullDelta #
PluginRequestMethod 'Method_TextDocumentTypeDefinition # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_TextDocumentTypeDefinition -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentTypeDefinition -> NonEmpty (MessageResult 'Method_TextDocumentTypeDefinition) -> MessageResult 'Method_TextDocumentTypeDefinition #
PluginRequestMethod 'Method_WorkspaceSymbol # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod 'Method_WorkspaceSymbol -> Config -> ClientCapabilities -> MessageParams 'Method_WorkspaceSymbol -> NonEmpty (MessageResult 'Method_WorkspaceSymbol) -> MessageResult 'Method_WorkspaceSymbol #
PluginRequestMethod ('Method_CustomMethod m :: Method 'ClientToServer 'Request) # |
Instance details Defined in Ide.Types Methods combineResponses :: SMethod ('Method_CustomMethod m :: Method 'ClientToServer 'Request) -> Config -> ClientCapabilities -> MessageParams ('Method_CustomMethod m :: Method 'ClientToServer 'Request) -> NonEmpty (MessageResult ('Method_CustomMethod m :: Method 'ClientToServer 'Request)) -> MessageResult ('Method_CustomMethod m :: Method 'ClientToServer 'Request) #

getProcessID :: IO Int #

getPid :: IO 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.

installSigUsr1Handler :: IO () -> IO () #

lookupCommandProvider :: IdePlugins ideState -> CommandId -> Maybe PluginId #

type ResolveFunction ideState a (m :: Method 'ClientToServer 'Request) = ideState -> PluginId -> MessageParams m -> Uri -> a -> ExceptT PluginError (HandlerM Config) (MessageResult m) #

mkResolveHandler :: forall ideState a (m :: Method 'ClientToServer 'Request). (FromJSON a, PluginRequestMethod m, HasData_ (MessageParams m) (Maybe Value)) => SClientMethod m -> ResolveFunction ideState a m -> PluginHandlers ideState #

Make a handler for resolve methods. In here we take your provided ResolveFunction and turn it into a PluginHandlers. See Note [Resolve in PluginHandlers]