packages feed

dap 0.5.0.0 → 0.6.0.0

raw patch · 5 files changed

+26/−6 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DAP.Adaptor: getClientCapabilities :: Adaptor app request (Maybe InitializeRequestArguments)
+ DAP.Types: [clientCapabilities] :: AdaptorLocal app request -> Maybe InitializeRequestArguments
+ DAP.Types: instance GHC.Internal.Base.Functor (DAP.Types.AdaptorLocal app)
- DAP.Types: AdaptorLocal :: AppStore app -> ServerConfig -> Handle -> SockAddr -> IORef (Maybe SessionId) -> MVar () -> LogAction IO DAPLog -> request -> AdaptorLocal app request
+ DAP.Types: AdaptorLocal :: AppStore app -> ServerConfig -> Handle -> SockAddr -> IORef (Maybe SessionId) -> MVar () -> LogAction IO DAPLog -> Maybe InitializeRequestArguments -> request -> AdaptorLocal app request

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for dap +## 0.6.0.0 -- 2026-05-04++* Keep track of the client capabilities reported by the Initialize request in+  the session (#32)+ ## 0.5.0.0 -- 2026-04-15  * No longer print "Handling" messages which cause confusion wrt actual errors occurring (#30)
dap.cabal view
@@ -1,5 +1,5 @@ name:               dap-version:            0.5.0.0+version:            0.6.0.0 description:        A library for the Debug Adaptor Protocol (DAP) synopsis:           A debug adaptor protocol library bug-reports:        https://github.com/haskell-debugger/dap/issues
src/DAP/Adaptor.hs view
@@ -59,6 +59,7 @@   , runAdaptorRequest   , withRequest   , getHandle+  , getClientCapabilities   ) where ---------------------------------------------------------------------------- import           Control.Concurrent.Lifted  ( fork, killThread )@@ -230,6 +231,9 @@ getCommand :: Adaptor app Request Command getCommand = command <$> asks request ----------------------------------------------------------------------------+getClientCapabilities :: Adaptor app request (Maybe InitializeRequestArguments)+getClientCapabilities = asks clientCapabilities+------------------------------------------------------------------------------- -- | 'sendRaw' (internal use only) -- Sends a raw JSON payload to the editor. No "seq", "type" or "command" fields are set. -- The message is still encoded with the ProtocolMessage Header, byte count, and CRLF.
src/DAP/Server.hs view
@@ -37,7 +37,7 @@                                             , toException                                             , throwIO ) import           Control.Monad              ( void )-import           Data.Aeson                 ( decodeStrict, eitherDecode, Value, FromJSON )+import           Data.Aeson                 ( decodeStrict, eitherDecode, Value, FromJSON, Result (..), fromJSON ) import           Data.Aeson.Encode.Pretty   ( encodePretty ) import           Data.ByteString            ( ByteString ) import           Data.Char                  ( isDigit )@@ -124,6 +124,7 @@   handleLock               <- newMVar ()   sessionId                <- newIORef Nothing   let request = ()+  let clientCapabilities = Nothing   pure AdaptorLocal     { ..     }@@ -142,16 +143,21 @@   -> IO () serviceClient communicate ackResp lcl = do   rrr_or_nextRequest <- runAdaptorPoly lcl st getRequest-  case rrr_or_nextRequest of+  lcl' <- case rrr_or_nextRequest of     Right nextRequest -> do-      let lcl' = lcl{ request = nextRequest }+      let lcl' = lcl{ request = nextRequest, clientCapabilities = clientCaps nextRequest }       runAdaptorRequest lcl' st $         communicate (command nextRequest)-    Left rrr ->+      pure (void lcl')+    Left rrr -> do       runAdaptorPoly lcl st $ ackResp rrr-  serviceClient communicate ackResp lcl+      pure lcl+  serviceClient communicate ackResp lcl'   where     st = AdaptorState MessageTypeResponse []+    clientCaps Request{command = CommandInitialize, args = Just (fromJSON -> Success v) }+      = Just v+    clientCaps _ = clientCapabilities lcl ---------------------------------------------------------------------------- -- | Handle exceptions from client threads, parse and log accordingly. -- Detects if client failed with `TerminateServer` and kills the server accordingly by sending an exception to the main thread.
src/DAP/Types.hs view
@@ -14,6 +14,7 @@ {-# LANGUAGE RecordWildCards            #-} {-# LANGUAGE DeriveAnyClass             #-} {-# LANGUAGE DeriveGeneric              #-}+{-# LANGUAGE DeriveFunctor              #-} {-# LANGUAGE LambdaCase                 #-} ---------------------------------------------------------------------------- module DAP.Types@@ -299,9 +300,13 @@   , logAction          :: LogAction IO DAPLog     -- ^ Where to send log output     --+  , clientCapabilities  :: Maybe InitializeRequestArguments+    -- ^ Taken from Initialize Command Requests+   , request             :: request     -- ^ Connection Request information, if we are responding to a request.   }+  deriving Functor  ---------------------------------------------------------------------------- type SessionId = Text