module Development.IDE.Plugin ( Plugin(..) ) where

import           Data.Default
import           Development.Shake

import           Development.IDE.LSP.Server
import qualified Language.LSP.Server        as LSP

data Plugin c = Plugin
    {Plugin c -> Rules ()
pluginRules    :: Rules ()
    ,Plugin c -> Handlers (ServerM c)
pluginHandlers :: LSP.Handlers (ServerM c)
    }

instance Default (Plugin c) where
    def :: Plugin c
def = Rules () -> Handlers (ServerM c) -> Plugin c
forall c. Rules () -> Handlers (ServerM c) -> Plugin c
Plugin Rules ()
forall a. Monoid a => a
mempty Handlers (ServerM c)
forall a. Monoid a => a
mempty

instance Semigroup (Plugin c) where
    Plugin Rules ()
x1 Handlers (ServerM c)
h1 <> :: Plugin c -> Plugin c -> Plugin c
<> Plugin Rules ()
x2 Handlers (ServerM c)
h2 = Rules () -> Handlers (ServerM c) -> Plugin c
forall c. Rules () -> Handlers (ServerM c) -> Plugin c
Plugin (Rules ()
x1Rules () -> Rules () -> Rules ()
forall a. Semigroup a => a -> a -> a
<>Rules ()
x2) (Handlers (ServerM c)
h1 Handlers (ServerM c)
-> Handlers (ServerM c) -> Handlers (ServerM c)
forall a. Semigroup a => a -> a -> a
<> Handlers (ServerM c)
h2)

instance Monoid (Plugin c) where
    mempty :: Plugin c
mempty = Plugin c
forall a. Default a => a
def