packages feed

dap 0.5.0.0 → 0.7.0.0

raw patch · 5 files changed

Files

CHANGELOG.md view
@@ -1,5 +1,16 @@ # Revision history for dap +## 0.7.0.0 -- 2026-05-20++* Fix exceptionOptions DAP conformance: it should be a list+* Fix reverse request: don't include response seq number which trips up some+  DAP clients++## 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.7.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.@@ -302,7 +306,7 @@   :: ReverseCommand   -> Adaptor app Request () sendReverseRequest rcmd = send $ do-  setField "type" MessageTypeRequest+  setType MessageTypeRequest   setField "command" rcmd ---------------------------------------------------------------------------- -- | Send runInTerminal reverse request
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@@ -3167,7 +3172,7 @@     -- corresponding capability `supportsExceptionFilterOptions` is true. The     -- `filter` and `filterOptions` sets are additive.     ---  , setExceptionBreakpointsArgumentsExceptionOptions :: Maybe ExceptionOptions+  , setExceptionBreakpointsArgumentsExceptionOptions :: Maybe [ExceptionOptions]    -- ^    -- Configuration options for selected exceptions.    -- The attribute is only honored by a debug adapter if the corresponding