Skip to content

Commit

Permalink
Revert "Prototypical HelloWorld implementation + refactoring."
Browse files Browse the repository at this point in the history
This reverts commit 3371b3b.
  • Loading branch information
AndyShiue committed Mar 1, 2024
1 parent 3371b3b commit 20710d0
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/Server/Handler2/CustomMethod.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE LambdaCase #-}

module Server.Handler2.CustomMethod where

Expand All @@ -13,8 +12,6 @@ import Server.Monad (ServerM)
import qualified Server.Monad (convertErrorsToResponsesAndDiagnostics)
import Error (Error(..))

import qualified Language.LSP.Server as LSP
import qualified Language.LSP.Types as LSP
import Server.Handler2.Utils
import qualified Server.Handler2.CustomMethod.Reload as Reload (handler)
import qualified Server.Handler2.CustomMethod.Inspect as Inspect (handler)
Expand All @@ -25,7 +22,7 @@ import qualified Server.Handler2.CustomMethod.SubstituteRedex
as SubstituteRedex (handler)
import qualified Server.Handler2.CustomMethod.HelloWorld as HelloWorld (handler)
import qualified Data.Text as Text
import Data.Aeson


handler :: JSON.Value -> (Response -> ServerM ()) -> ServerM ()
handler params responder = do
Expand All @@ -49,18 +46,7 @@ handler params responder = do
ReqRefine2 range text -> Refine.slowHandler range text respondResult reportError
ReqInsertProofTemplate range hash -> InsertProofTemplate.slowHandler filePath range hash respondResult reportError
ReqSubstitute redexNumber -> SubstituteRedex.handler filePath redexNumber respondResult reportError
ReqHelloWorld range -> do
let requestParams =
LSP.ShowMessageRequestParams
LSP.MtInfo
(Text.pack . show . encode $ ReqHelloWorld range)
Nothing
_ <- LSP.sendRequest LSP.SWindowShowMessageRequest requestParams $ \case
Right _ ->
LSP.sendNotification LSP.SWindowShowMessage (LSP.ShowMessageParams LSP.MtInfo "Just saying hello again!")
Left err ->
LSP.sendNotification LSP.SWindowShowMessage (LSP.ShowMessageParams LSP.MtError $ "Something went wrong!\n" <> Text.pack (show err))
HelloWorld.handler range respondResult reportError
ReqHelloWorld range -> HelloWorld.handler range respondResult reportError
_ -> reportError (Others "Not implemented yet.")
where
reportError :: Error -> ServerM ()
Expand Down

0 comments on commit 20710d0

Please sign in to comment.