hls-plugin-api-2.9.0.0: Haskell Language Server API for plugin communication
Safe HaskellSafe-Inferred
LanguageGHC2021

Ide.Types

Synopsis

Documentation

data PluginDescriptor (ideState :: Type) Source #

Constructors

PluginDescriptor 

Fields

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

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 Source #

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

newtype IdeCommand state Source #

Constructors

IdeCommand (state -> IO ()) 

Instances

Instances details
Show (IdeCommand st) Source # 
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) Source #

Methods which have a PluginMethod instance

Constructors

PluginRequestMethod m => IdeMethod (SMethod m) 

Instances

Instances details
GCompare IdeMethod Source # 
Instance details

Defined in Ide.Types

Methods

gcompare :: forall (a :: k) (b :: k). IdeMethod a -> IdeMethod b -> GOrdering a b #

GEq IdeMethod Source # 
Instance details

Defined in Ide.Types

Methods

geq :: forall (a :: k) (b :: k). IdeMethod a -> IdeMethod b -> Maybe (a :~: b) #

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

Methods which have a PluginMethod instance

Constructors

PluginNotificationMethod m => IdeNotification (SMethod m) 

Instances

Instances details
GCompare IdeNotification Source # 
Instance details

Defined in Ide.Types

Methods

gcompare :: forall (a :: k) (b :: k). IdeNotification a -> IdeNotification b -> GOrdering a b #

GEq IdeNotification Source # 
Instance details

Defined in Ide.Types

Methods

geq :: forall (a :: k) (b :: k). IdeNotification a -> IdeNotification b -> Maybe (a :~: b) #

data IdePlugins ideState where Source #

Bundled Patterns

pattern IdePlugins :: [PluginDescriptor ideState] -> IdePlugins ideState

Smart constructor that deduplicates plugins

Instances

Instances details
Monoid (IdePlugins a) Source # 
Instance details

Defined in Ide.Types

Semigroup (IdePlugins a) Source # 
Instance details

Defined in Ide.Types

data DynFlagsModifications Source #

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

Constructors

DynFlagsModifications 

Fields

data Config Source #

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.

Instances

Instances details
ToJSON Config Source # 
Instance details

Defined in Ide.Types

Show Config Source # 
Instance details

Defined in Ide.Types

Default Config Source # 
Instance details

Defined in Ide.Types

Methods

def :: Config #

Eq Config Source # 
Instance details

Defined in Ide.Types

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

data PluginConfig Source #

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.

Instances

Instances details
ToJSON PluginConfig Source # 
Instance details

Defined in Ide.Types

Show PluginConfig Source # 
Instance details

Defined in Ide.Types

Default PluginConfig Source # 
Instance details

Defined in Ide.Types

Methods

def :: PluginConfig #

Eq PluginConfig Source # 
Instance details

Defined in Ide.Types

data CheckParents Source #

Instances

Instances details
FromJSON CheckParents Source # 
Instance details

Defined in Ide.Types

ToJSON CheckParents Source # 
Instance details

Defined in Ide.Types

Generic CheckParents Source # 
Instance details

Defined in Ide.Types

Associated Types

type Rep CheckParents :: Type -> Type #

Show CheckParents Source # 
Instance details

Defined in Ide.Types

Eq CheckParents Source # 
Instance details

Defined in Ide.Types

Ord CheckParents Source # 
Instance details

Defined in Ide.Types

type Rep CheckParents Source # 
Instance details

Defined in Ide.Types

type Rep CheckParents = D1 ('MetaData "CheckParents" "Ide.Types" "hls-plugin-api-2.9.0.0-7CgpzEGM3js8Q4N91fQzKl" '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 Source #

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 Source # 
Instance details

Defined in Ide.Types

ToJSON SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

Generic SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

Associated Types

type Rep SessionLoadingPreferenceConfig :: Type -> Type #

Show SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

Eq SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

Ord SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

Pretty SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

type Rep SessionLoadingPreferenceConfig Source # 
Instance details

Defined in Ide.Types

type Rep SessionLoadingPreferenceConfig = D1 ('MetaData "SessionLoadingPreferenceConfig" "Ide.Types" "hls-plugin-api-2.9.0.0-7CgpzEGM3js8Q4N91fQzKl" 'False) (C1 ('MetaCons "PreferSingleComponentLoading" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PreferMultiComponentLoading" 'PrefixI 'False) (U1 :: Type -> Type))

data ConfigDescriptor Source #

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

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

Lookup the current config for a plugin

data CustomConfig Source #

An existential wrapper of Properties

Constructors

forall r. CustomConfig (Properties r) 

data FallbackCodeActionParams Source #

Constructors

FallbackCodeActionParams 

Fields

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.

Constructors

FormatText 
FormatRange Range 

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

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

class HasTracing a where Source #

Minimal complete definition

Nothing

Methods

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

Instances

Instances details
HasTracing Value Source # 
Instance details

Defined in Ide.Types

HasTracing CallHierarchyIncomingCallsParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> CallHierarchyIncomingCallsParams -> IO () Source #

HasTracing CallHierarchyOutgoingCallsParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> CallHierarchyOutgoingCallsParams -> IO () Source #

HasTracing CodeAction Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> CodeAction -> IO () Source #

HasTracing CodeLens Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> CodeLens -> IO () Source #

HasTracing CompletionItem Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> CompletionItem -> IO () Source #

HasTracing DidChangeConfigurationParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> DidChangeConfigurationParams -> IO () Source #

HasTracing DidChangeWatchedFilesParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> DidChangeWatchedFilesParams -> IO () Source #

HasTracing DidChangeWorkspaceFoldersParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> DidChangeWorkspaceFoldersParams -> IO () Source #

HasTracing DocumentLink Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> DocumentLink -> IO () Source #

HasTracing ExecuteCommandParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> ExecuteCommandParams -> IO () Source #

HasTracing InitializeParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> InitializeParams -> IO () Source #

HasTracing InitializedParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> InitializedParams -> IO () Source #

HasTracing InlayHint Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> InlayHint -> IO () Source #

HasTracing WorkspaceSymbol Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> WorkspaceSymbol -> IO () Source #

HasTracing WorkspaceSymbolParams Source # 
Instance details

Defined in Ide.Types

Methods

traceWithSpan :: SpanInFlight -> WorkspaceSymbolParams -> IO () Source #

(HasTextDocument a doc, HasUri doc Uri) => HasTracing a Source # 
Instance details

Defined in Ide.Types

Methods

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

data PluginCommand ideState Source #

Constructors

forall a.FromJSON a => PluginCommand 

newtype CommandId Source #

Constructors

CommandId Text 

Instances

Instances details
IsString CommandId Source # 
Instance details

Defined in Ide.Types

Read CommandId Source # 
Instance details

Defined in Ide.Types

Show CommandId Source # 
Instance details

Defined in Ide.Types

Eq CommandId Source # 
Instance details

Defined in Ide.Types

Ord CommandId Source # 
Instance details

Defined in Ide.Types

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

newtype PluginId Source #

Constructors

PluginId Text 

Instances

Instances details
FromJSON PluginId Source # 
Instance details

Defined in Ide.Types

ToJSON PluginId Source # 
Instance details

Defined in Ide.Types

IsString PluginId Source # 
Instance details

Defined in Ide.Types

Read PluginId Source # 
Instance details

Defined in Ide.Types

Show PluginId Source # 
Instance details

Defined in Ide.Types

Eq PluginId Source # 
Instance details

Defined in Ide.Types

Ord PluginId Source # 
Instance details

Defined in Ide.Types

Hashable PluginId Source # 
Instance details

Defined in Ide.Types

Methods

hashWithSalt :: Int -> PluginId -> Int #

hash :: PluginId -> Int #

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

Combine handlers for the

Constructors

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

mkPluginHandler :: forall ideState m. PluginRequestMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState Source #

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

data HandlerM config a Source #

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) Source # 
Instance details

Defined in Ide.Types

Methods

liftIO :: IO a -> HandlerM config a #

Applicative (HandlerM config) Source # 
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) Source # 
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) Source # 
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) Source # 
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 Source #

pluginGetClientCapabilities :: HandlerM config ClientCapabilities Source #

Wrapper of getClientCapabilities for HandlerM

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

Wrapper of getVirtualFile for HandlerM

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

pluginGetVersionedTextDoc :: TextDocumentIdentifier -> HandlerM config VersionedTextDocumentIdentifier Source #

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 () Source #

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) Source #

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 Source #

Wrapper of withIndefiniteProgress for HandlerM

class HasTracing (MessageParams m) => PluginMethod (k :: MessageKind) (m :: Method ClientToServer k) 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

Minimal complete definition

Nothing

Methods

handlesRequest Source #

Arguments

:: SMethod m

Method type.

-> MessageParams m

Whether a plugin is enabled might depend on the message parameters e.g. $sel:pluginFileType:PluginDescriptor 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 Source #

Instances

Instances details
PluginMethod 'Notification 'Method_Initialized Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_Initialized -> MessageParams 'Method_Initialized -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_TextDocumentDidChange Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDidChange -> MessageParams 'Method_TextDocumentDidChange -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_TextDocumentDidClose Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDidClose -> MessageParams 'Method_TextDocumentDidClose -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_TextDocumentDidOpen Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDidOpen -> MessageParams 'Method_TextDocumentDidOpen -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_TextDocumentDidSave Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDidSave -> MessageParams 'Method_TextDocumentDidSave -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_WorkspaceDidChangeConfiguration Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_WorkspaceDidChangeConfiguration -> MessageParams 'Method_WorkspaceDidChangeConfiguration -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_WorkspaceDidChangeWatchedFiles Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_WorkspaceDidChangeWatchedFiles -> MessageParams 'Method_WorkspaceDidChangeWatchedFiles -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Notification 'Method_WorkspaceDidChangeWorkspaceFolders Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_WorkspaceDidChangeWorkspaceFolders -> MessageParams 'Method_WorkspaceDidChangeWorkspaceFolders -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_CallHierarchyIncomingCalls Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_CallHierarchyIncomingCalls -> MessageParams 'Method_CallHierarchyIncomingCalls -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_CallHierarchyOutgoingCalls Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_CallHierarchyOutgoingCalls -> MessageParams 'Method_CallHierarchyOutgoingCalls -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_CodeActionResolve Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_CodeActionResolve -> MessageParams 'Method_CodeActionResolve -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_CodeLensResolve Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_CodeLensResolve -> MessageParams 'Method_CodeLensResolve -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_CompletionItemResolve Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_CompletionItemResolve -> MessageParams 'Method_CompletionItemResolve -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentCodeAction Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentCodeAction -> MessageParams 'Method_TextDocumentCodeAction -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentCodeLens Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentCodeLens -> MessageParams 'Method_TextDocumentCodeLens -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentCompletion Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentCompletion -> MessageParams 'Method_TextDocumentCompletion -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentDefinition Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDefinition -> MessageParams 'Method_TextDocumentDefinition -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentDocumentHighlight Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDocumentHighlight -> MessageParams 'Method_TextDocumentDocumentHighlight -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentDocumentSymbol Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentDocumentSymbol -> MessageParams 'Method_TextDocumentDocumentSymbol -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentFoldingRange Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentFoldingRange -> MessageParams 'Method_TextDocumentFoldingRange -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentFormatting Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentFormatting -> MessageParams 'Method_TextDocumentFormatting -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentHover Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentHover -> MessageParams 'Method_TextDocumentHover -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentPrepareCallHierarchy Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentPrepareCallHierarchy -> MessageParams 'Method_TextDocumentPrepareCallHierarchy -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentPrepareRename Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentPrepareRename -> MessageParams 'Method_TextDocumentPrepareRename -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentRangeFormatting Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentRangeFormatting -> MessageParams 'Method_TextDocumentRangeFormatting -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentReferences Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentReferences -> MessageParams 'Method_TextDocumentReferences -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentRename Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentRename -> MessageParams 'Method_TextDocumentRename -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentSelectionRange Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentSelectionRange -> MessageParams 'Method_TextDocumentSelectionRange -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentSemanticTokensFull Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentSemanticTokensFull -> MessageParams 'Method_TextDocumentSemanticTokensFull -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentSemanticTokensFullDelta Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentSemanticTokensFullDelta -> MessageParams 'Method_TextDocumentSemanticTokensFullDelta -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_TextDocumentTypeDefinition Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_TextDocumentTypeDefinition -> MessageParams 'Method_TextDocumentTypeDefinition -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_WorkspaceExecuteCommand Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_WorkspaceExecuteCommand -> MessageParams 'Method_WorkspaceExecuteCommand -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request 'Method_WorkspaceSymbol Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod 'Method_WorkspaceSymbol -> MessageParams 'Method_WorkspaceSymbol -> PluginDescriptor c -> Config -> HandleRequestResult Source #

PluginMethod 'Request ('Method_CustomMethod m :: Method 'ClientToServer 'Request) Source # 
Instance details

Defined in Ide.Types

Methods

handlesRequest :: SMethod ('Method_CustomMethod m) -> MessageParams ('Method_CustomMethod m) -> PluginDescriptor c -> Config -> HandleRequestResult Source #

type PluginMethodHandler a m = a -> PluginId -> MessageParams m -> ExceptT PluginError (HandlerM Config) (MessageResult m) Source #

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

Constructors

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

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

Make a handler for plugins with no extra data

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

Minimal complete definition

Nothing

Methods

combineResponses Source #

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 Source #

Instances

Instances details
PluginRequestMethod 'Method_CallHierarchyIncomingCalls Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_CallHierarchyIncomingCalls -> Config -> ClientCapabilities -> MessageParams 'Method_CallHierarchyIncomingCalls -> NonEmpty (MessageResult 'Method_CallHierarchyIncomingCalls) -> MessageResult 'Method_CallHierarchyIncomingCalls Source #

PluginRequestMethod 'Method_CallHierarchyOutgoingCalls Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_CallHierarchyOutgoingCalls -> Config -> ClientCapabilities -> MessageParams 'Method_CallHierarchyOutgoingCalls -> NonEmpty (MessageResult 'Method_CallHierarchyOutgoingCalls) -> MessageResult 'Method_CallHierarchyOutgoingCalls Source #

PluginRequestMethod 'Method_CodeActionResolve Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_CodeActionResolve -> Config -> ClientCapabilities -> MessageParams 'Method_CodeActionResolve -> NonEmpty (MessageResult 'Method_CodeActionResolve) -> MessageResult 'Method_CodeActionResolve Source #

PluginRequestMethod 'Method_CodeLensResolve Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_CodeLensResolve -> Config -> ClientCapabilities -> MessageParams 'Method_CodeLensResolve -> NonEmpty (MessageResult 'Method_CodeLensResolve) -> MessageResult 'Method_CodeLensResolve Source #

PluginRequestMethod 'Method_CompletionItemResolve Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_CompletionItemResolve -> Config -> ClientCapabilities -> MessageParams 'Method_CompletionItemResolve -> NonEmpty (MessageResult 'Method_CompletionItemResolve) -> MessageResult 'Method_CompletionItemResolve Source #

PluginRequestMethod 'Method_TextDocumentCodeAction Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentCodeAction -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentCodeAction -> NonEmpty (MessageResult 'Method_TextDocumentCodeAction) -> MessageResult 'Method_TextDocumentCodeAction Source #

PluginRequestMethod 'Method_TextDocumentCodeLens Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentCodeLens -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentCodeLens -> NonEmpty (MessageResult 'Method_TextDocumentCodeLens) -> MessageResult 'Method_TextDocumentCodeLens Source #

PluginRequestMethod 'Method_TextDocumentCompletion Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentCompletion -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentCompletion -> NonEmpty (MessageResult 'Method_TextDocumentCompletion) -> MessageResult 'Method_TextDocumentCompletion Source #

PluginRequestMethod 'Method_TextDocumentDefinition Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentDefinition -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentDefinition -> NonEmpty (MessageResult 'Method_TextDocumentDefinition) -> MessageResult 'Method_TextDocumentDefinition Source #

PluginRequestMethod 'Method_TextDocumentDocumentHighlight Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentDocumentHighlight -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentDocumentHighlight -> NonEmpty (MessageResult 'Method_TextDocumentDocumentHighlight) -> MessageResult 'Method_TextDocumentDocumentHighlight Source #

PluginRequestMethod 'Method_TextDocumentDocumentSymbol Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentDocumentSymbol -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentDocumentSymbol -> NonEmpty (MessageResult 'Method_TextDocumentDocumentSymbol) -> MessageResult 'Method_TextDocumentDocumentSymbol Source #

PluginRequestMethod 'Method_TextDocumentFoldingRange Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentFoldingRange -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentFoldingRange -> NonEmpty (MessageResult 'Method_TextDocumentFoldingRange) -> MessageResult 'Method_TextDocumentFoldingRange Source #

PluginRequestMethod 'Method_TextDocumentFormatting Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentFormatting -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentFormatting -> NonEmpty (MessageResult 'Method_TextDocumentFormatting) -> MessageResult 'Method_TextDocumentFormatting Source #

PluginRequestMethod 'Method_TextDocumentHover Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentHover -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentHover -> NonEmpty (MessageResult 'Method_TextDocumentHover) -> MessageResult 'Method_TextDocumentHover Source #

PluginRequestMethod 'Method_TextDocumentPrepareCallHierarchy Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentPrepareCallHierarchy -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentPrepareCallHierarchy -> NonEmpty (MessageResult 'Method_TextDocumentPrepareCallHierarchy) -> MessageResult 'Method_TextDocumentPrepareCallHierarchy Source #

PluginRequestMethod 'Method_TextDocumentPrepareRename Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentPrepareRename -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentPrepareRename -> NonEmpty (MessageResult 'Method_TextDocumentPrepareRename) -> MessageResult 'Method_TextDocumentPrepareRename Source #

PluginRequestMethod 'Method_TextDocumentRangeFormatting Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentRangeFormatting -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentRangeFormatting -> NonEmpty (MessageResult 'Method_TextDocumentRangeFormatting) -> MessageResult 'Method_TextDocumentRangeFormatting Source #

PluginRequestMethod 'Method_TextDocumentReferences Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentReferences -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentReferences -> NonEmpty (MessageResult 'Method_TextDocumentReferences) -> MessageResult 'Method_TextDocumentReferences Source #

PluginRequestMethod 'Method_TextDocumentRename Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentRename -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentRename -> NonEmpty (MessageResult 'Method_TextDocumentRename) -> MessageResult 'Method_TextDocumentRename Source #

PluginRequestMethod 'Method_TextDocumentSelectionRange Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentSelectionRange -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentSelectionRange -> NonEmpty (MessageResult 'Method_TextDocumentSelectionRange) -> MessageResult 'Method_TextDocumentSelectionRange Source #

PluginRequestMethod 'Method_TextDocumentSemanticTokensFull Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentSemanticTokensFull -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentSemanticTokensFull -> NonEmpty (MessageResult 'Method_TextDocumentSemanticTokensFull) -> MessageResult 'Method_TextDocumentSemanticTokensFull Source #

PluginRequestMethod 'Method_TextDocumentSemanticTokensFullDelta Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentSemanticTokensFullDelta -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentSemanticTokensFullDelta -> NonEmpty (MessageResult 'Method_TextDocumentSemanticTokensFullDelta) -> MessageResult 'Method_TextDocumentSemanticTokensFullDelta Source #

PluginRequestMethod 'Method_TextDocumentTypeDefinition Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_TextDocumentTypeDefinition -> Config -> ClientCapabilities -> MessageParams 'Method_TextDocumentTypeDefinition -> NonEmpty (MessageResult 'Method_TextDocumentTypeDefinition) -> MessageResult 'Method_TextDocumentTypeDefinition Source #

PluginRequestMethod 'Method_WorkspaceSymbol Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod 'Method_WorkspaceSymbol -> Config -> ClientCapabilities -> MessageParams 'Method_WorkspaceSymbol -> NonEmpty (MessageResult 'Method_WorkspaceSymbol) -> MessageResult 'Method_WorkspaceSymbol Source #

PluginRequestMethod ('Method_CustomMethod m :: Method 'ClientToServer 'Request) Source # 
Instance details

Defined in Ide.Types

Methods

combineResponses :: SMethod ('Method_CustomMethod m) -> Config -> ClientCapabilities -> MessageParams ('Method_CustomMethod m) -> NonEmpty (MessageResult ('Method_CustomMethod m)) -> MessageResult ('Method_CustomMethod m) Source #

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

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

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

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