module Ide.Plugin.Class (descriptor, Log(..)) where import Development.IDE (IdeState, Recorder, WithPriority) import Ide.Plugin.Class.CodeAction import Ide.Plugin.Class.CodeLens import Ide.Plugin.Class.Types import Ide.Types import Language.LSP.Protocol.Message descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState descriptor Recorder (WithPriority Log) recorder PluginId plId = (forall ideState. PluginId -> PluginDescriptor ideState defaultPluginDescriptor PluginId plId) { pluginCommands :: [PluginCommand IdeState] pluginCommands = PluginId -> [PluginCommand IdeState] commands PluginId plId , pluginRules :: Rules () pluginRules = Recorder (WithPriority Log) -> Rules () rules Recorder (WithPriority Log) recorder , pluginHandlers :: PluginHandlers IdeState pluginHandlers = forall ideState (m :: Method 'ClientToServer 'Request). PluginRequestMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState mkPluginHandler SMethod 'Method_TextDocumentCodeAction SMethod_TextDocumentCodeAction (Recorder (WithPriority Log) -> PluginMethodHandler IdeState 'Method_TextDocumentCodeAction codeAction Recorder (WithPriority Log) recorder) forall a. Semigroup a => a -> a -> a <> forall ideState (m :: Method 'ClientToServer 'Request). PluginRequestMethod m => SClientMethod m -> PluginMethodHandler ideState m -> PluginHandlers ideState mkPluginHandler SMethod 'Method_TextDocumentCodeLens SMethod_TextDocumentCodeLens PluginMethodHandler IdeState 'Method_TextDocumentCodeLens codeLens } commands :: PluginId -> [PluginCommand IdeState] commands :: PluginId -> [PluginCommand IdeState] commands PluginId plId = [ forall ideState a. FromJSON a => CommandId -> Text -> CommandFunction ideState a -> PluginCommand ideState PluginCommand CommandId codeActionCommandId Text "add placeholders for minimal methods" (PluginId -> CommandFunction IdeState AddMinimalMethodsParams addMethodPlaceholders PluginId plId) , forall ideState a. FromJSON a => CommandId -> Text -> CommandFunction ideState a -> PluginCommand ideState PluginCommand CommandId typeLensCommandId Text "add type signatures for instance methods" CommandFunction IdeState WorkspaceEdit codeLensCommandHandler ]