dhall-lsp-server 1.1.1 → 1.1.2
raw patch · 3 files changed
+62/−11 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Dhall.LSP.Handlers: cancelationHandler :: Handlers HandlerM
+ Dhall.LSP.Handlers: handleErrorWithDefault :: (Either a1 b -> HandlerM a2) -> b -> HandlerM a2 -> HandlerM a2
+ Dhall.LSP.Handlers: initializedHandler :: Handlers HandlerM
+ Dhall.LSP.Handlers: textDocumentChangeHandler :: Handlers HandlerM
+ Dhall.LSP.Handlers: workspaceChangeConfigurationHandler :: Handlers HandlerM
Files
- dhall-lsp-server.cabal +6/−6
- src/Dhall/LSP/Handlers.hs +48/−5
- src/Dhall/LSP/Server.hs +8/−0
dhall-lsp-server.cabal view
@@ -1,5 +1,5 @@ name: dhall-lsp-server-Version: 1.1.1+Version: 1.1.2 cabal-version: 1.12 synopsis: Language Server Protocol (LSP) server for Dhall homepage: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server#readme@@ -42,7 +42,7 @@ src default-extensions: RecordWildCards OverloadedStrings build-depends:- aeson >= 1.3.1.1 && < 2.1+ aeson >= 1.3.1.1 && < 2.2 , aeson-pretty >= 0.8.7 && < 0.9 , base >= 4.11 && < 5 , bytestring >= 0.10.8.2 && < 0.12@@ -53,7 +53,7 @@ , dhall-json >= 1.4 && < 1.8 , filepath >= 1.4.2 && < 1.5 , lsp >= 1.2.0.0 && < 1.5- , rope-utf16-splay >= 0.3.1.0 && < 0.4+ , rope-utf16-splay >= 0.3.1.0 && < 0.5 , hslogger >= 1.2.10 && < 1.4 , lens >= 4.16.1 && < 5.2 -- megaparsec follows SemVer: https://github.com/mrkkrp/megaparsec/issues/469#issuecomment-927918469@@ -61,7 +61,7 @@ , mtl >= 2.2.2 && < 2.3 , network-uri >= 2.6.1.0 && < 2.7 , prettyprinter >= 1.7.0 && < 1.8- , text >= 1.2.3.0 && < 1.3+ , text >= 1.2.3.0 && < 2.1 , transformers >= 0.5.5.0 && < 0.6 , unordered-containers >= 0.2.9.0 && < 0.3 , uri-encode >= 1.5.0.5 && < 1.6@@ -105,10 +105,10 @@ Build-Depends: base , lsp-types >= 1.2.0.0 && < 1.5 ,- hspec >= 2.7 && < 2.10 ,+ hspec >= 2.7 && < 2.11 , lsp-test >= 0.13.0.0 && < 0.15 , tasty >= 0.11.2 && < 1.5 , tasty-hspec >= 1.1 && < 1.3 ,- text >= 0.11 && < 1.3+ text >= 0.11 && < 2.1 Build-Tool-Depends: dhall-lsp-server:dhall-lsp-server Default-Language: Haskell2010
src/Dhall/LSP/Handlers.hs view
@@ -132,7 +132,7 @@ hoverHandler :: Handlers HandlerM hoverHandler =- LSP.requestHandler STextDocumentHover \request respond -> do+ LSP.requestHandler STextDocumentHover \request respond -> handleErrorWithDefault respond Nothing do let uri_ = request^.params.textDocument.uri let Position{ _line = fromIntegral -> _line, _character = fromIntegral -> _character } = request^.params.position@@ -185,7 +185,7 @@ documentLinkHandler :: Handlers HandlerM documentLinkHandler =- LSP.requestHandler STextDocumentDocumentLink \request respond -> do+ LSP.requestHandler STextDocumentDocumentLink \request respond -> handleErrorWithDefault respond (List []) do let uri_ = request^.params.textDocument.uri path <- case uriToFilePath uri_ of@@ -293,7 +293,7 @@ documentFormattingHandler :: Handlers HandlerM documentFormattingHandler =- LSP.requestHandler STextDocumentFormatting \request respond -> do+ LSP.requestHandler STextDocumentFormatting \request respond -> handleErrorWithDefault respond (List []) do let _uri = request^.params.textDocument.uri txt <- readUri _uri@@ -310,9 +310,10 @@ respond (Right (List [TextEdit{..}])) + executeCommandHandler :: Handlers HandlerM executeCommandHandler =- LSP.requestHandler SWorkspaceExecuteCommand \request respond -> do+ LSP.requestHandler SWorkspaceExecuteCommand \request respond -> handleErrorWithDefault respond Aeson.Null do let command_ = request^.params.command if | command_ == "dhall.server.lint" -> executeLintAndFormat request respond@@ -504,7 +505,7 @@ completionHandler :: Handlers HandlerM completionHandler =- LSP.requestHandler STextDocumentCompletion \request respond -> do+ LSP.requestHandler STextDocumentCompletion \request respond -> handleErrorWithDefault respond (InR (CompletionList False (List []))) do let uri_ = request ^. params . textDocument . uri line_ = fromIntegral (request ^. params . position . line) col_ = fromIntegral (request ^. params . position . character)@@ -612,3 +613,45 @@ LSP.notificationHandler STextDocumentDidSave \notification -> do let _uri = notification^.params.textDocument.uri diagnosticsHandler _uri+++-- this handler is a stab to prevent `lsp:no handler for:` messages.+initializedHandler :: Handlers HandlerM+initializedHandler = + LSP.notificationHandler SInitialized \_ -> return ()++-- this handler is a stab to prevent `lsp:no handler for:` messages.+workspaceChangeConfigurationHandler :: Handlers HandlerM+workspaceChangeConfigurationHandler = + LSP.notificationHandler SWorkspaceDidChangeConfiguration \_ -> return ()++-- this handler is a stab to prevent `lsp:no handler for:` messages.+textDocumentChangeHandler :: Handlers HandlerM+textDocumentChangeHandler =+ LSP.notificationHandler STextDocumentDidChange \_ -> return ()++-- this handler is a stab to prevent `lsp:no handler for:` messages.+cancelationHandler :: Handlers HandlerM+cancelationHandler =+ LSP.notificationHandler SCancelRequest \_ -> return ()++handleErrorWithDefault :: (Either a1 b -> HandlerM a2)+ -> b+ -> HandlerM a2+ -> HandlerM a2+handleErrorWithDefault respond _default = flip catchE handler + where+ handler (Log, _message) = do+ let _xtype = MtLog+ liftLSP $ LSP.sendNotification SWindowLogMessage LogMessageParams{..}+ respond (Right _default)++ handler (severity_, _message) = do+ let _xtype = case severity_ of+ Error -> MtError+ Warning -> MtWarning+ Info -> MtInfo+ Log -> MtLog++ liftLSP $ LSP.sendNotification SWindowShowMessage ShowMessageParams{..}+ respond (Right _default)
src/Dhall/LSP/Server.hs view
@@ -16,6 +16,10 @@ , documentLinkHandler , executeCommandHandler , hoverHandler+ , initializedHandler+ , workspaceChangeConfigurationHandler+ , textDocumentChangeHandler+ , cancelationHandler ) import Dhall.LSP.State import Language.LSP.Server (Options(..), ServerDefinition(..), type (<~>)(..))@@ -76,6 +80,10 @@ , documentFormattingHandler , documentLinkHandler , completionHandler+ , initializedHandler+ , workspaceChangeConfigurationHandler+ , textDocumentChangeHandler+ , cancelationHandler ] let interpretHandler environment = Iso{..}