{-# LANGUAGE DataKinds #-}

module Unison.LSP.NotificationHandlers where

import Language.LSP.Protocol.Message qualified as Msg
import Unison.Debug qualified as Debug
import Unison.LSP.Types

initializedHandler :: Msg.TNotificationMessage 'Msg.Method_Initialized -> Lsp ()
initializedHandler :: TNotificationMessage 'Method_Initialized -> Lsp ()
initializedHandler TNotificationMessage 'Method_Initialized
_ = () -> Lsp ()
forall a. a -> Lsp a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()

withDebugging :: (Show m) => (m -> Lsp ()) -> (m -> Lsp ())
withDebugging :: forall m. Show m => (m -> Lsp ()) -> m -> Lsp ()
withDebugging m -> Lsp ()
handler m
message = do
  DebugFlag -> String -> m -> Lsp ()
forall a (m :: * -> *).
(Show a, Monad m) =>
DebugFlag -> String -> a -> m ()
Debug.debugM DebugFlag
Debug.LSP String
"Notification" m
message
  m -> Lsp ()
handler m
message

setTraceHandler :: Msg.TNotificationMessage 'Msg.Method_SetTrace -> Lsp ()
setTraceHandler :: TNotificationMessage 'Method_SetTrace -> Lsp ()
setTraceHandler TNotificationMessage 'Method_SetTrace
_ =
  -- We don't handle trace messages yet, but we get warnings if we don't handle them.
  () -> Lsp ()
forall a. a -> Lsp a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()