source-repository-package
type: git
location: https://github.com/alanz/lsp.git
- tag: ba6a7409f830be09f815489265a76499d7b7debb
+ tag: 7577be56392862abe880e0099ea9834a1012a34f
subdir: .
lsp-types
IsClientEither -> sendMessage (NotMess $ NotificationMessage "2.0" method params)
-- | Sends a response to the server.
-sendResponse :: ToJSON (ResponseParams m) => ResponseMessage m -> Session ()
+sendResponse :: ToJSON (ResponseResult m) => ResponseMessage m -> Session ()
sendResponse = sendMessage
-- | Returns the initialize response that was received from the server.
getImplementations = getDeclarationyRequest STextDocumentImplementation ImplementationParams
-getDeclarationyRequest :: (ResponseParams m ~ (Location |? (List Location |? List LocationLink)))
+getDeclarationyRequest :: (ResponseResult m ~ (Location |? (List Location |? List LocationLink)))
=> SClientMethod m
-> (TextDocumentIdentifier
-> Position
-- | Checks the response for errors and throws an exception if needed.
-- Returns the result if successful.
-getResponseResult :: ResponseMessage m -> ResponseParams m
+getResponseResult :: ResponseMessage m -> ResponseResult m
getResponseResult rsp =
case rsp ^. result of
Right x -> x
import Control.Monad
import Control.Monad.Reader
-import Data.Aeson
-import Data.Default
+import Data.Aeson hiding (defaultOptions)
import qualified Data.HashMap.Strict as HM
import Data.List (isSuffixOf)
-import Language.LSP.Control
-import Language.LSP.Core
+import Language.LSP.Server
import Language.LSP.Types
import System.Directory
import System.FilePath
main = do
handlerEnv <- HandlerEnv <$> newEmptyMVar <*> newEmptyMVar
- let initCbs =
- InitializeCallbacks
+ runServer $ ServerDefinition
{ doInitialize = \env _req -> pure $ Right env,
onConfigurationChange = const $ pure $ Right (),
staticHandlers = handlers,
interpretHandler = \env ->
Iso
(\m -> runLspT env (runReaderT m handlerEnv))
- liftIO
+ liftIO,
+ options = defaultOptions {executeCommandCommands = Just ["doAnEdit"]}
}
- options = def {executeCommandCommands = Just ["doAnEdit"]}
- run initCbs options
data HandlerEnv = HandlerEnv
{ relRegToken :: MVar (RegistrationToken WorkspaceDidChangeWatchedFiles),